QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#81809#2838. 2D GeometryAHSFNU_team_0#WA 2ms3584kbC++14526b2023-02-26 13:47:312023-02-26 13:47:33

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-26 13:47:33]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3584kb
  • [2023-02-26 13:47:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,x[200005],y[200005],num,t,ans;
mt19937 rnd(20230226);
int main(){
	while(~scanf("%d",&n)){
		for(int i=1;i<=n;++i)
			scanf("%d%d",x+i,y+i);
		ans=n;
		for(int k=1,u,v;k<=100;++k){
			u=rnd()%n+1,v=rnd()%n+1;
			if(u==v)continue;
			num=0;
			for(int i=1;i<=n;++i)
				if((ll)(x[u]-x[i])*(y[v]-y[i])==(ll)(x[v]-x[i])*(y[u]-y[i]))++num;
			t=min(num/2,n-num);
			ans=min(ans,n-t*3);
		}
		printf("%d\n",max(ans,0));
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3564kb

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: 2ms
memory: 3584kb

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:

1
2
3
0
1
1
4
2
2
2
2
5
3
3
0
3
3
0
3
3
3
6

result:

wrong answer 13th lines differ - expected: '0', found: '3'