QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#614644 | #2364. Endgame | m5588ohammed | WA | 1ms | 7784kb | C++20 | 1.2kb | 2024-10-05 16:43:52 | 2024-10-05 16:43:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,ai,aj,bi,bj;
int x[200001],y[200001],rx[200001],ry[200001];
map <pair<int,int>,bool> mp;
bool ins(int i,int j){
if(i>0&&i<=n&&j>0&&j<=n) return 1;
else return 0;
}
bool capture(int i1,int j1,int i2,int j2){
mp.clear();
mp[{i1,j1}]=1;
for(int i=0;i<n;i++){
if(ins(i1+x[i],j1+y[i])==1) mp[{i1+x[i],j1+y[i]}]=1;
}
if(mp[{i2,j2}]==1) return 1;
for(int i=0;i<n;i++){
if(ins(i2+rx[i],j2+ry[i])==1&&mp[{i2+rx[i],j2+ry[i]}]==1) return 1;
}
return 0;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
srand(time(NULL));
cin>>n;
cin>>ai>>aj>>bi>>bj;
aj-=n-1;
bj-=n-1;
for(int i=0;i<n;i++){
cin>>x[i]>>y[i];
y[i]*=-1;
rx[i]=x[i]*-1;
ry[i]=y[i]*-1;
}
int k=100;
if(capture(ai,aj,bi,bj)==1){
cout<<"Alice wins"<<endl;
return 0;
}
while(k--){
int i=rand()%n+1;
int j=rand()%n+1;
if(capture(bi,bj,i,j)==0){
cout<<"tie "<<i<<" "<<j<<endl;
return 0;
}
}
cout<<"Bob wins"<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 7732kb
input:
3 2 3 1 3 1 0 0 -1 1 -1
output:
Bob wins
result:
ok
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 7784kb
input:
3 3 3 1 1 1 0 1 1 0 1
output:
tie 1 2
result:
wrong answer Author claims 'tie', but judge claims 'bob'