QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21725 | #2838. 2D Geometry | CCF_NOI# | WA | 3ms | 3624kb | C++20 | 1011b | 2022-03-08 14:35:36 | 2022-05-08 03:59:41 |
Judging History
answer
#include<algorithm>
#include<iostream>
#include<random>
#include<vector>
#include<cstdio>
using namespace std;
#define ll long long
#define For(i,l,r) for(int i=l;i<=r;i++)
#define FOR(i,l,r) for(int i=l;i>=r;i--)
#define MAXN 200001
int T,N,x[MAXN],y[MAXN];mt19937 rnd(time(0));
int get(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
pair<int,int>turn(int x,int y){if(x<0)x=-x,y=-y;int z=y>0?y:-y;int t=__gcd(x,z);x/=t,z/=t;if(y<0)z=-z;return pair<int,int>(x,z);}
int main()
{
while(cin>>N)
{
For(i,1,N)x[i]=get(),y[i]=get();int mx=min(N,2);
For(t,1,10)
{
int x=rnd()%N+1;vector<pair<int,int>>tmp;For(i,1,N)if(i!=x)tmp.push_back(turn(::x[x]-::x[i],::y[x]-::y[i]));
sort(tmp.begin(),tmp.end());int cnt=1,M=tmp.size()-1;For(i,1,M)if(tmp[i]==tmp[i-1])cnt++;else mx=max(mx,cnt+1),cnt=1;mx=max(mx,cnt+1);
}
if(mx>(N-mx)*2)cout<<N-(N-mx)*3<<'\n';else cout<<N%3<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3624kb
input:
3 0 0 0 1 0 2 3 0 0 0 1 1 0 6 0 0 0 1 0 2 0 3 1 1 1 2
output:
3 0 0
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3560kb
input:
1 0 0 2 0 0 1 1 3 0 0 0 1 0 2 3 0 0 0 1 1 0 4 3 0 0 2 3 3 3 1 4 2 3 1 1 0 3 0 2 4 0 0 0 3 0 2 0 1 5 8 6 9 2 2 3 7 4 1 5 5 2 2 4 2 6 2 7 2 0 4 5 3 7 5 4 4 4 9 4 9 9 5 5 4 5 9 5 5 4 3 1 0 5 3 2 1 2 7 2 6 2 5 2 6 7 2 7 9 0 3 8 8 4 4 3 8 6 2 8 2 5 3 5 3 8 2 0 0 2 6 2 3 8 4 2 9 2 2 2 6 4 9 6 2 1 7 6 6 5 ...
output:
4 2 3 0 1 1 4 2 2 2 2 5 0 0 0 0 0 0 0 3 0 6
result:
wrong answer 1st lines differ - expected: '1', found: '4'