QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#538062#2615. Surround the CatLavine#WA 0ms3972kbC++142.0kb2024-08-30 22:22:402024-08-30 22:22:40

Judging History

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

  • [2024-08-30 22:22:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3972kb
  • [2024-08-30 22:22:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=105,k1[6][2]={1,1,1,0,0,-1,-1,-1,-1,0,0,1},k2[6][2]={1,2,2,1,1,-1,-1,-2,-2,-1,-1,1},P=50;
int v[N][N],cx,cy,g[N][N];
void Pt(int x,int y){
    printf("%d %d\n",x,y);
    g[x+P][y+P]=1;
    fflush(stdout);
}
void init(){
    for(int i=0;i<=9;++i)v[9+P][i+P]=v[i+P][9+P]=1;
    for(int i=0;i<=9;++i)v[P-i][P+9-i]=v[P-9][P-i]=1;
    for(int i=0;i<=9;++i)v[P-i][P-9]=v[P+i][P-9+i]=1;
    scanf("%d %d",&cx,&cy);
    Pt(9,1);
    
    scanf("%d %d",&cx,&cy);
    Pt(8,9);
    scanf("%d %d",&cx,&cy);
    Pt(-1,8);
    scanf("%d %d",&cx,&cy);
    Pt(-9,-1);
    scanf("%d %d",&cx,&cy);
    Pt(-8,-9);
    scanf("%d %d",&cx,&cy);
    Pt(-1,8);
    scanf("%d %d",&cx,&cy);
}
bool ck(int x,int y){
    return v[x+P][y+P]&&!g[x+P][y+P];
}
void Rd(){
    bool fl=1;
    for(int i=0;i<6;++i){
        int x=cx+k1[i][0],y=cy+k1[i][1];
        if(!g[x][y]){
            fl=0;
            break;
        }
    }
    if(fl){
        puts("win");
        exit(0);
    }
    scanf("%d %d",&cx,&cy);
    while(g[cx+P][cy+P]){
        puts("cat can't walk here.");
        scanf("%d %d",&cx,&cy);
    }
    if(v[cx][cy]){
        puts("lose");
        exit(0);
    }
}
vector<pair<int,int> >nb1,nb2;
int main(){
    init();
    while(1){
        nb1.clear(),nb2.clear();
        for(int i=0;i<6;++i){
            if(ck(cx+k1[i][0],cy+k1[i][1]))nb1.push_back(make_pair(cx+k1[i][0],cy+k1[i][1]));
            if(ck(cx+k2[i][0],cy+k2[i][1]))nb2.push_back(make_pair(cx+k2[i][0],cy+k2[i][1]));
        }
        if(!nb1.empty()){
            for(auto t:nb1)Pt(t.first,t.second);
        }else if(!nb2.empty()){
            for(auto t:nb2)Pt(t.first,t.second);
        }else {
            for(int i=0;i<6;++i){
                int x=cx+k1[i][0],y=cy+k1[i][1];
                if(!g[x][y]){
                    Pt(x,y);
                    break;
                }
            }
        }
        Rd();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3972kb

input:

0 0
1 0
2 1
3 2
4 3
5 4
6 5
7 5
7 4
7 3
7 4
7 3
7 2
7 1
7 2
7 1
7 2
7 3
7 2
7 1
7 2
7 3
7 4
7 5
7 4
7 5
7 4
7 5
7 4
7 3
7 2
7 3
7 2
7 1
7 0
7 1
7 0
6 -1
5 -2
4 -3
5 -2
4 -3
3 -4
4 -3
3 -4
2 -5
3 -4
2 -5
1 -6
2 -5
1 -6
0 -7

output:

9 1
8 9
-1 8
-9 -1
-8 -9
-1 8
7 6
9 6
9 5
9 4
8 5
8 4
9 3
9 2
8 3
8 2
8 3
8 4
8 3
8 2
8 3
8 4
8 5
8 6
8 5
8 6
8 5
8 6
8 5
8 4
8 3
8 4
8 3
8 2
8 -1
8 2
8 1
7 -2
6 -3
5 -4
6 -1
5 -2
4 -5
5 -2
4 -3
3 -6
4 -3
3 -4
2 -7
3 -4
2 -5
lose

result:

wrong answer format  Expected integer, but "lose" found