QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21727 | #2838. 2D Geometry | CCF_NOI# | WA | 3ms | 3632kb | C++20 | 1.0kb | 2022-03-08 14:36:10 | 2022-05-08 03:59:49 |
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);
}
mx=max(mx,N);if(mx>(N-mx)*2)cout<<N-(N-mx)*3<<'\n';else cout<<N%3<<'\n';
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 3632kb
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 3 6
result:
wrong answer 2nd lines differ - expected: '0', found: '3'