Submission #2208912


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 0
Code Size 1228 Byte
Status CE

Compile Error

./Main.cpp:19:12: error: ‘__int64’ does not name a type
 #define ll __int64
            ^
./Main.cpp:21:1: note: in expansion of macro ‘ll’
 ll n;
 ^
./Main.cpp:19:12: error: ‘__int64’ does not name a type
 #define ll __int64
            ^
./Main.cpp:24:1: note: in expansion of macro ‘ll’
 ll ans1,ans2,ans3;
 ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:27:7: error: ‘n’ was not declared in this scope
  cin>>n;
       ^
./Main.cpp:43:4: error: ‘ans2’ was not declared in this scope
    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);
    ^
./Main.cpp:44:4: error: ‘ans3’ was not declared in this scope
    ans3+=lower_bound(sita.begin(),sita.end(),sita[j]+M_PI-EPS)-upper_bound(sita.begin(),sita.end(),sita[j]+M_PI/2+EPS);
    ^
./Main.cpp:47:2: error: ‘ans1’ was not declared in this scope
  ans1=n*(n-1)*(n-2)/6;
  ^
./Main.cpp:49:13: error: ‘ans2’ was not declared in this scope
  cout<<ans1-ans2-ans3<<" "<<ans2<<" "<<ans3<<endl;
 ...