Submission #1794479


Source Code Expand

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = 1e-10;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
pair<long double, long double> p[10001];

int main() {
	cin >> n;
	rep(i, n) {
		cin >> p[i].first >> p[i].second;
	}
	ll r = 0, o = 0;
	rep(i, n) {
		//cout << "!" << i << endl;
		vector<long double> vd;
		rep(j, n) {
			if (i != j) {
				long double px = p[j].first - p[i].first;
				long double py = p[j].second - p[i].second;
				long double a = atan2(py, px);
				vd.push_back(a);
				vd.push_back(a + 2.0 * PI);
			}
		}
		sort(ALL(vd));
		rep(j, vd.size() / 2) {
			auto it1 = upper_bound(ALL(vd), vd[j] + PI / 2.0 + EPS);
			auto it2 = lower_bound(ALL(vd), vd[j] + PI / 2.0 - EPS);
			auto ub = lower_bound(ALL(vd), vd[j] + PI - EPS);
			//cout << *it1 << " " << *it2 << " " << *ub << endl;
			r += (it1 - it2);
			o += (ub - it1);
		}
		//cout << "!!" << r << " " << o << endl;
	}
	ll num = n*(n - 1)*(n - 2) / 6;
	cout << num - o - r << " " << r << " " << o << endl;
}

Submission Info

Submission Time
Task D - 三角形の分類
User jimmy
Language C++14 (GCC 5.4.1)
Score 30
Code Size 2248 Byte
Status WA
Exec Time 1360 ms
Memory 384 KB

Judge Result

Set Name sample subtask01 subtask02
Score / Max Score 0 / 0 30 / 30 0 / 70
Status
AC × 2
AC × 28
AC × 43
WA × 13
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 1 ms 256 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 2 ms 256 KB
01-06.txt AC 2 ms 256 KB
01-07.txt AC 4 ms 256 KB
01-08.txt AC 4 ms 256 KB
01-09.txt AC 4 ms 256 KB
01-10.txt AC 4 ms 256 KB
01-11.txt AC 4 ms 256 KB
01-12.txt AC 4 ms 256 KB
01-13.txt AC 4 ms 256 KB
01-14.txt AC 4 ms 256 KB
01-15.txt AC 4 ms 256 KB
01-16.txt AC 4 ms 256 KB
01-17.txt AC 4 ms 256 KB
01-18.txt AC 4 ms 256 KB
01-19.txt AC 4 ms 256 KB
01-handmade00.txt AC 2 ms 256 KB
01-handmade01.txt AC 4 ms 256 KB
01-handmade02.txt AC 2 ms 256 KB
01-handmade03.txt AC 4 ms 256 KB
01-handmade04.txt AC 4 ms 256 KB
01-handmade05.txt AC 4 ms 256 KB
02-00.txt AC 13 ms 256 KB
02-01.txt AC 50 ms 256 KB
02-02.txt AC 50 ms 256 KB
02-03.txt AC 155 ms 384 KB
02-04.txt AC 155 ms 384 KB
02-05.txt AC 156 ms 384 KB
02-06.txt AC 324 ms 384 KB
02-07.txt AC 323 ms 384 KB
02-08.txt AC 325 ms 384 KB
02-09.txt AC 323 ms 384 KB
02-10.txt AC 324 ms 384 KB
02-11.txt AC 324 ms 384 KB
02-12.txt AC 326 ms 384 KB
02-13.txt WA 1357 ms 384 KB
02-14.txt WA 1357 ms 384 KB
02-15.txt WA 1358 ms 384 KB
02-16.txt WA 1357 ms 384 KB
02-17.txt WA 1348 ms 384 KB
02-18.txt WA 1358 ms 384 KB
02-19.txt WA 1358 ms 384 KB
02-handmade00.txt WA 627 ms 384 KB
02-handmade01.txt WA 1353 ms 384 KB
02-handmade02.txt WA 744 ms 384 KB
02-handmade03.txt WA 1349 ms 384 KB
02-handmade04.txt WA 1359 ms 384 KB
02-handmade05.txt WA 1360 ms 384 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB