QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#614704#2364. Endgamem5588ohammedWA 2ms9792kbC++201.5kb2024-10-05 16:50:192024-10-05 16:50:20

Judging History

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

  • [2024-10-05 16:50:20]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:9792kb
  • [2024-10-05 16:50:19]
  • 提交

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-aj+1;
    bj=n-bj+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;
    }
    if(capture(ai,aj,bi,bj)==1){
        cout<<"Alice wins"<<endl;
        return 0;
    }
    if(n<=300){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                if(capture(bi,bj,i,j)==0){
                    cout<<"tie "<<i<<" "<<j<<endl;
                    return 0;
                }    
            }
        }
    }
    else{
        int k=100;
        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;
}

详细

Test #1:

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

input:

3
2 3
1 3
1 0
0 -1
1 -1

output:

Bob wins

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 7884kb

input:

3
3 3
1 1
1 0
1 1
0 1

output:

Bob wins

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 7872kb

input:

3
2 2
3 1
-1 0
-1 1
0 1

output:

Bob wins

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 7868kb

input:

5
2 1
1 2
-2 2
1 -1
1 1
2 2
3 3

output:

tie 1 1

result:

ok 

Test #5:

score: -100
Wrong Answer
time: 1ms
memory: 7876kb

input:

2
1 1
1 2
1 -1
1 1

output:

tie 1 2

result:

wrong answer Author coordinates coincide with Bob's position