QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#18203 | #2213. Knight | Xiao_Luo_Xuan | WA | 24ms | 18068kb | C++ | 840b | 2022-01-16 19:26:04 | 2022-05-04 17:20:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1100;
int n,m,r,c,x,y,X,Y,cnt;
char S[N][N];
int col[N][N];
void dfs(int x,int y,int w){
if(x<1 || x>n || y<1 || y>m || S[x][y]=='#' || col[x][y]!=-1) return ;
col[x][y]=w;
cnt++;
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);
// for(int i=1;i<=n;i++){
// for(int j=1;j<=m;j++){
// cout<<col[i][j]<<" ";
// }
// cout<<endl;
// }
if(cnt>1 && (col[X][Y]==-1 || col[X][Y]==col[x][y])) puts("Alice");
else puts("Bob");
}
详细
Test #1:
score: 100
Accepted
time: 9ms
memory: 9132kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 9248kb
Test #3:
score: 0
Accepted
time: 15ms
memory: 13740kb
Test #4:
score: 0
Accepted
time: 24ms
memory: 18068kb
Test #5:
score: 0
Accepted
time: 2ms
memory: 8856kb
Test #6:
score: 0
Accepted
time: 5ms
memory: 8832kb
Test #7:
score: -100
Wrong Answer
time: 4ms
memory: 8476kb