QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190608#2838. 2D Geometryqzez#WA 0ms3540kbC++141.2kb2023-09-29 07:31:402023-09-29 07:31:41

Judging History

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

  • [2023-09-29 07:31:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3540kb
  • [2023-09-29 07:31:40]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;using LL=__int128;
const int N=2e5+5,M=N*100+5,K=600+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
int n;
struct vec{
	int x,y;
	vec operator -(const vec &B)const{return (vec){x-B.x,y-B.y};}
	ll operator *(const vec &B)const{return 1ll*x*B.y-1ll*y*B.x;}
}A[N];
void Solve(){
	int i,j;if(scanf("%d",&n)==-1) exit(0);
	for(i=1;i<=n;i++) scanf("%d%d",&A[i].x,&A[i].y);
	int ans=1;
	if(n==1) {printf("%d\n",1);return;}
	int T=50;while(T--){
		int x=R(n),y=R(n);while(x==y) y=R(n);
		int Ct=0;
		for(j=1;j<=n;j++) if((A[j]-A[x])*(A[y]-A[x])==0) Ct++;
		ans=max(ans,Ct);
	}
	if(ans<(n-ans)*2) printf("0\n");
	else printf("%d\n",ans-2*(n-ans));
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(1) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

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: 3540kb

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
0
4
0
2
0
0
5
0
0
0
0
0
0
0
3
0
6

result:

wrong answer 6th lines differ - expected: '1', found: '0'