Submission #2208914


Source Code Expand

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>

#define ll __int64
#define __int64 long long
ll n;
int x[2100];
int y[2100];
ll ans1,ans2,ans3;
double EPS=1e-9;
int main(){
	cin>>n;
	rep(i,n)cin>>x[i]>>y[i];


	rep(i,n){
		vector<double>sita;
		rep(j,n){
			if(i==j)continue;
			sita.push_back(atan2(y[j]-y[i],x[j]-x[i]));
		}	

		sort(sita.begin(),sita.end());
		rep(j,n-1)sita.push_back(sita[j]+2*M_PI);

		rep(j,n-1){
			//cout<<(lower_bound(sita.begin(),sita.end(),sita[j]+90)-sita.begin())<<" "<<lower_bound(sita.begin(),sita.end(),sita[j]+90-EPS)-sita.begin()<<endl;
			ans2+=upper_bound(sita.begin(),sita.end(),sita[j]+M_PI/2+EPS)-lower_bound(sita.begin(),sita.end(),sita[j]+M_PI/2-EPS);
			ans3+=lower_bound(sita.begin(),sita.end(),sita[j]+M_PI-EPS)-upper_bound(sita.begin(),sita.end(),sita[j]+M_PI/2+EPS);
		}
	}
	ans1=n*(n-1)*(n-2)/6;
	
	cout<<ans1-ans2-ans3<<" "<<ans2<<" "<<ans3<<endl;
	return 0;
}

Submission Info

Submission Time
Task D - 三角形の分類
User pappagukun
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1226 Byte
Status AC
Exec Time 882 ms
Memory 384 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 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 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 9 ms 256 KB
02-01.txt AC 33 ms 256 KB
02-02.txt AC 34 ms 256 KB
02-03.txt AC 103 ms 256 KB
02-04.txt AC 103 ms 256 KB
02-05.txt AC 103 ms 256 KB
02-06.txt AC 214 ms 256 KB
02-07.txt AC 213 ms 256 KB
02-08.txt AC 214 ms 256 KB
02-09.txt AC 213 ms 256 KB
02-10.txt AC 213 ms 256 KB
02-11.txt AC 213 ms 256 KB
02-12.txt AC 214 ms 256 KB
02-13.txt AC 879 ms 384 KB
02-14.txt AC 881 ms 384 KB
02-15.txt AC 879 ms 384 KB
02-16.txt AC 882 ms 384 KB
02-17.txt AC 879 ms 384 KB
02-18.txt AC 881 ms 384 KB
02-19.txt AC 877 ms 384 KB
02-handmade00.txt AC 411 ms 256 KB
02-handmade01.txt AC 880 ms 384 KB
02-handmade02.txt AC 487 ms 384 KB
02-handmade03.txt AC 881 ms 384 KB
02-handmade04.txt AC 882 ms 384 KB
02-handmade05.txt AC 881 ms 384 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB