Submission #1593598


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair< int, int >;

double eps = 1e-10;

int main() {
    int n;
    cin >> n;

    vector<ll> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];

    ll c=0, d=0;
    rep(i, n) {
        vector<double> a;
        rep(j, n) {
            if (j != i) a.push_back(atan2(y[j]-y[i], x[j]-x[i]));
        }
        sort(a.begin(), a.end());
        rep(j, n-1) a.push_back(a[j] + M_PI*2);
        rep(j, n-1) {
            int x = lower_bound(a.begin(), a.end(), a[j] + M_PI/2 - eps) - a.begin();
            int y = upper_bound(a.begin(), a.end(), a[j] + M_PI/2 + eps) - a.begin();
            int z = lower_bound(a.begin(), a.end(), a[j] + M_PI) - a.begin();
            c += y - x;
            d += z - y;
        }
    }

    ll e = (ll)n * (n-1) * (n-2) / 6 - c - d;
    cout << e << ' ' << c << ' ' << d << endl;
}

Submission Info

Submission Time
Task D - 三角形の分類
User dsytk7
Language C++14 (GCC 5.4.1)
Score 100
Code Size 978 Byte
Status AC
Exec Time 758 ms
Memory 640 KB

Judge Result

Set Name sample subtask01 subtask02
Score / Max Score 0 / 0 30 / 30 70 / 70
Status
AC × 2
AC × 28
AC × 56
Set Name Test Cases
sample sample-01.txt, sample-02.txt
subtask01 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, sample-01.txt, sample-02.txt
subtask02 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, 02-00.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt, 02-17.txt, 02-18.txt, 02-19.txt, 02-handmade00.txt, 02-handmade01.txt, 02-handmade02.txt, 02-handmade03.txt, 02-handmade04.txt, 02-handmade05.txt, sample-01.txt, sample-02.txt, sample-01.txt, sample-02.txt
Case Name Status Exec Time Memory
01-00.txt AC 6 ms 640 KB
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 1 ms 256 KB
01-05.txt AC 1 ms 256 KB
01-06.txt AC 1 ms 256 KB
01-07.txt AC 3 ms 256 KB
01-08.txt AC 3 ms 256 KB
01-09.txt AC 3 ms 256 KB
01-10.txt AC 3 ms 256 KB
01-11.txt AC 3 ms 256 KB
01-12.txt AC 3 ms 256 KB
01-13.txt AC 3 ms 256 KB
01-14.txt AC 3 ms 256 KB
01-15.txt AC 3 ms 256 KB
01-16.txt AC 3 ms 256 KB
01-17.txt AC 3 ms 256 KB
01-18.txt AC 3 ms 256 KB
01-19.txt AC 3 ms 256 KB
01-handmade00.txt AC 2 ms 256 KB
01-handmade01.txt AC 3 ms 256 KB
01-handmade02.txt AC 2 ms 256 KB
01-handmade03.txt AC 3 ms 256 KB
01-handmade04.txt AC 3 ms 256 KB
01-handmade05.txt AC 3 ms 256 KB
02-00.txt AC 8 ms 256 KB
02-01.txt AC 29 ms 256 KB
02-02.txt AC 29 ms 256 KB
02-03.txt AC 89 ms 256 KB
02-04.txt AC 89 ms 256 KB
02-05.txt AC 89 ms 256 KB
02-06.txt AC 183 ms 256 KB
02-07.txt AC 182 ms 256 KB
02-08.txt AC 183 ms 256 KB
02-09.txt AC 182 ms 256 KB
02-10.txt AC 182 ms 256 KB
02-11.txt AC 183 ms 256 KB
02-12.txt AC 183 ms 256 KB
02-13.txt AC 752 ms 384 KB
02-14.txt AC 754 ms 384 KB
02-15.txt AC 751 ms 384 KB
02-16.txt AC 754 ms 384 KB
02-17.txt AC 752 ms 384 KB
02-18.txt AC 758 ms 384 KB
02-19.txt AC 751 ms 384 KB
02-handmade00.txt AC 352 ms 384 KB
02-handmade01.txt AC 753 ms 384 KB
02-handmade02.txt AC 417 ms 384 KB
02-handmade03.txt AC 752 ms 384 KB
02-handmade04.txt AC 755 ms 384 KB
02-handmade05.txt AC 753 ms 384 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB