QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#450729 | #2838. 2D Geometry | grass8cow# | WA | 1ms | 7116kb | C++17 | 811b | 2024-06-22 17:28:09 | 2024-06-22 17:28:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
#define ll long long
struct no{
ll x,y;
no(){x=0,y=0;}
no(ll x_,ll y_){x=x_,y=y_;}
}a[200100];
no operator - (const no &a,const no &b) {return no(a.x-b.x,a.y-b.y);}
ll sat(no a,no b){return a.x*b.y-a.y*b.x;}
mt19937 rnd(time(0));
int u,v;
void mk(){
u=rnd()%n+1,v=rnd()%n+1;
while(u==v)u=rnd()%n+1,v=rnd()%n+1;
}
int D;
void sol(){
if(n<=2){printf("%d\n",n);return;}
for(int i=1;i<=n;i++)scanf("%lld%lld",&a[i].x,&a[i].y);
int step=100;
D=0;
while(step--){
mk();int su=0;
for(int i=1;i<=n;i++)
if(sat(a[i]-a[u],a[i]-a[v])==0)su++;
D=max(D,su);
}
printf("%d\n",n-min(n/3,n-D)*3);
}
int main(){
while(~scanf("%d",&n))sol();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6940kb
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: 1ms
memory: 7116kb
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 0 0 2 0 0 1 1 3 0 1 1 4 2 2 2 2 5 0 0 0 0 0 0 0 3 0 6
result:
wrong answer 2nd lines differ - expected: '2', found: '0'