Submission #34381175


Source Code Expand

#include"bits/stdc++.h"

using namespace std;

vector<double> ax(4), ay(4);

double lr(int i1, int i2, int i3) {
    return (ax[i1]-ax[i3])*(ay[i2]-ay[i3])-(ay[i1]-ay[i3])*(ax[i2]-ax[i3]);
}

bool check(int i1, int i2, int i3) {
    double a = lr(i1, i2, i3);
    double b = lr(i2, i3, (i3+1)%4);
    return a*b >= 0;
}

int main() {
    // freopen("A.in" , "r" , stdin);
    // freopen("A.out" , "w" , stdout);
    for (int i = 0; i < 4; ++i) cin >> ax[i] >> ay[i];
    bool ans = true;
    ans = check(0, 1, 2) && check(1, 2, 3) && check(2, 3, 0) && check(3, 0, 1);
    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - Convex Quadrilateral
User ZzZZCHS
Language C++ (GCC 9.2.1)
Score 300
Code Size 710 Byte
Status AC
Exec Time 10 ms
Memory 3724 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 34
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 10 ms 3652 KiB
random_02.txt AC 2 ms 3656 KiB
random_03.txt AC 2 ms 3540 KiB
random_04.txt AC 2 ms 3640 KiB
random_05.txt AC 2 ms 3608 KiB
random_06.txt AC 2 ms 3540 KiB
random_07.txt AC 4 ms 3608 KiB
random_08.txt AC 3 ms 3552 KiB
random_09.txt AC 2 ms 3604 KiB
random_10.txt AC 4 ms 3660 KiB
random_11.txt AC 2 ms 3648 KiB
random_12.txt AC 3 ms 3604 KiB
random_13.txt AC 3 ms 3608 KiB
random_14.txt AC 1 ms 3608 KiB
random_15.txt AC 2 ms 3644 KiB
random_16.txt AC 2 ms 3608 KiB
random_17.txt AC 2 ms 3560 KiB
random_18.txt AC 2 ms 3604 KiB
random_19.txt AC 2 ms 3652 KiB
random_20.txt AC 1 ms 3560 KiB
random_21.txt AC 2 ms 3652 KiB
random_22.txt AC 3 ms 3584 KiB
random_23.txt AC 2 ms 3656 KiB
random_24.txt AC 2 ms 3640 KiB
random_25.txt AC 2 ms 3604 KiB
random_26.txt AC 2 ms 3608 KiB
random_27.txt AC 2 ms 3640 KiB
random_28.txt AC 2 ms 3576 KiB
random_29.txt AC 2 ms 3576 KiB
random_30.txt AC 3 ms 3552 KiB
random_31.txt AC 5 ms 3604 KiB
random_32.txt AC 2 ms 3560 KiB
sample_01.txt AC 3 ms 3724 KiB
sample_02.txt AC 3 ms 3724 KiB