QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#62162 | #2838. 2D Geometry | defathom# | WA | 3ms | 7800kb | C++14 | 1.7kb | 2022-11-17 16:26:02 | 2022-11-17 16:26:05 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
const int N=1e6+5;
//const ll mod=998244373;
using namespace std;
int n,t;
int x[N],y[N],p[N];
int cnt,ans;
int main()
{
srand(time(0));
//ios_base::sync_with_stdio(0);
//cin.tie(0);
while(scanf("%d",&n)!=EOF)
{
cnt=0;
for(int i=1;i<=n;++i)
{
cin>>x[i]>>y[i];
p[i]=i;
}
if(n==1)
{
printf("1\n");
continue;
}
if(n==2)
{
printf("2\n");
continue;
}
queue<pair<int,int>>q;
random_shuffle(p+1,p+1+n);
for(int i=1;i<=n;++i)
{
int g=p[i];
q.push({x[g],y[g]});
}
int nx1=q.front().first;
int ny1=q.front().second;
q.pop();
int nx2=q.front().first;
int ny2=q.front().second;
q.pop();
while(!q.empty())
{
//++cnt;
if(cnt==100)
break;
int nx3=q.front().first;
int ny3=q.front().second;
q.pop();
if(!q.size())
break;
if(nx1==nx2&&nx2==nx3)
{
++cnt;
q.push({nx3,ny3});
continue;
}
if(ny1==ny2&&ny2==ny3)
{
++cnt;
q.push({nx3,ny3});
continue;
}
nx1=q.front().first;
ny1=q.front().second;
q.pop();
nx2=q.front().first;
ny2=q.front().second;
q.pop();
}
if(q.size())
printf("%d\n",q.size()+2);
else
printf("0");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 7800kb
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:
000
result:
wrong answer 1st lines differ - expected: '3', found: '000'