QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#18201 | #2213. Knight | Appleblue17# | WA | 6ms | 9144kb | C++ | 655b | 2022-01-16 19:21:39 | 2022-05-04 17:20:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1100;
int n,m,r,c,x,y,X,Y;
char S[N][N];
int col[N][N];
void dfs(int x,int y,int w){
if(col[x][y]) return ;
col[x][y]=w;
dfs(x-r,y-c,w^1);
dfs(x-r,y+c,w^1);
dfs(x+r,y-c,w^1);
dfs(x+r,y+c,w^1);
dfs(x-c,y-r,w^1);
dfs(x-c,y+r,w^1);
dfs(x+c,y-r,w^1);
dfs(x+c,y+r,w^1);
}
int main(){
cin>>n>>m>>r>>c;
for(int i=1;i<=n;i++){
scanf("\n%s",S[i]+1);
for(int j=1;j<=m;j++){
if(S[i][j]=='A') x=i,y=j;
if(S[i][j]=='B') X=i,Y=j;
}
}
memset(col,-1,sizeof(col));
dfs(x,y,0);
if(col[X][Y]==-1 || col[X][Y]==col[x][y]) puts("Alice");
else puts("Bob");
}
Details
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 9144kb