QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#18063 | #2213. Knight | YLiF4# | WA | 77ms | 50864kb | C++14 | 963b | 2022-01-16 09:13:41 | 2022-05-04 17:00:49 |
Judging History
answer
#include<cstdio>
const int maxn=1010;
int a[maxn][maxn],n,m,r,c,siz;
char s[maxn][maxn];
void dfs(int x,int y,const int dir[8][2]){
siz++;
for(int i=0;i<8;i++){
int tx=x+dir[i][0],ty=y+dir[i][1];
if(tx<1||ty<1||tx>n||ty>m){
continue;
}
if(s[tx][ty]=='@'){
continue;
}
if(a[tx][ty]!=-1){
continue;
}
a[tx][ty]=1-a[x][y];
dfs(tx,ty,dir);
}
}
int main(){
scanf("%d%d%d%d",&n,&m,&r,&c);
const int dir[8][2]={{r,c},{-r,c},{c,r},{-c,r},{r,-c},{-r,-c},{c,-r},{-r,c}};
for(int i=1;i<=n;i++){
scanf("%s",&s[i][1]);
for(int j=1;j<=m;j++){
a[i][j]=-1;
}
}
int bx,by,ax,ay;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(s[i][j]=='A'){
a[i][j]=0;ax=i,ay=j;
dfs(i,j,dir);
}else if(s[i][j]=='B'){
bx=i,by=j;
}
}
}
if(siz==1){
puts("Bob");
return 0;
}
if(a[bx][by]==-1||a[ax][ay]==a[bx][by]){
puts("Alice");return 0;
}
puts("Bob");
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 7ms
memory: 4752kb
Test #2:
score: 0
Accepted
time: 2ms
memory: 3904kb
Test #3:
score: 0
Accepted
time: 18ms
memory: 11476kb
Test #4:
score: 0
Accepted
time: 15ms
memory: 9316kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3672kb
Test #6:
score: 0
Accepted
time: 5ms
memory: 6176kb
Test #7:
score: 0
Accepted
time: 1ms
memory: 3668kb
Test #8:
score: 0
Accepted
time: 4ms
memory: 4560kb
Test #9:
score: 0
Accepted
time: 6ms
memory: 6476kb
Test #10:
score: 0
Accepted
time: 1ms
memory: 6252kb
Test #11:
score: 0
Accepted
time: 4ms
memory: 4632kb
Test #12:
score: 0
Accepted
time: 4ms
memory: 5316kb
Test #13:
score: 0
Accepted
time: 4ms
memory: 6892kb
Test #14:
score: 0
Accepted
time: 0ms
memory: 6252kb
Test #15:
score: 0
Accepted
time: 4ms
memory: 5444kb
Test #16:
score: 0
Accepted
time: 6ms
memory: 6372kb
Test #17:
score: 0
Accepted
time: 1ms
memory: 3588kb
Test #18:
score: 0
Accepted
time: 3ms
memory: 4004kb
Test #19:
score: 0
Accepted
time: 1ms
memory: 4196kb
Test #20:
score: 0
Accepted
time: 1ms
memory: 6224kb
Test #21:
score: 0
Accepted
time: 1ms
memory: 1708kb
Test #22:
score: 0
Accepted
time: 4ms
memory: 4188kb
Test #23:
score: 0
Accepted
time: 2ms
memory: 4000kb
Test #24:
score: 0
Accepted
time: 7ms
memory: 6140kb
Test #25:
score: 0
Accepted
time: 4ms
memory: 6376kb
Test #26:
score: 0
Accepted
time: 2ms
memory: 3720kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 3724kb
Test #28:
score: 0
Accepted
time: 17ms
memory: 23296kb
Test #29:
score: 0
Accepted
time: 4ms
memory: 4352kb
Test #30:
score: 0
Accepted
time: 8ms
memory: 5776kb
Test #31:
score: 0
Accepted
time: 0ms
memory: 4000kb
Test #32:
score: 0
Accepted
time: 2ms
memory: 3956kb
Test #33:
score: 0
Accepted
time: 9ms
memory: 6716kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 5380kb
Test #35:
score: 0
Accepted
time: 7ms
memory: 9868kb
Test #36:
score: 0
Accepted
time: 3ms
memory: 6464kb
Test #37:
score: 0
Accepted
time: 4ms
memory: 4684kb
Test #38:
score: 0
Accepted
time: 3ms
memory: 5172kb
Test #39:
score: 0
Accepted
time: 1ms
memory: 4528kb
Test #40:
score: 0
Accepted
time: 3ms
memory: 5732kb
Test #41:
score: 0
Accepted
time: 3ms
memory: 5008kb
Test #42:
score: 0
Accepted
time: 5ms
memory: 5908kb
Test #43:
score: 0
Accepted
time: 3ms
memory: 5868kb
Test #44:
score: 0
Accepted
time: 3ms
memory: 5756kb
Test #45:
score: 0
Accepted
time: 3ms
memory: 4556kb
Test #46:
score: 0
Accepted
time: 2ms
memory: 5844kb
Test #47:
score: 0
Accepted
time: 0ms
memory: 4580kb
Test #48:
score: 0
Accepted
time: 8ms
memory: 8236kb
Test #49:
score: 0
Accepted
time: 4ms
memory: 5428kb
Test #50:
score: 0
Accepted
time: 3ms
memory: 4312kb
Test #51:
score: 0
Accepted
time: 70ms
memory: 20768kb
Test #52:
score: 0
Accepted
time: 18ms
memory: 14776kb
Test #53:
score: 0
Accepted
time: 2ms
memory: 6552kb
Test #54:
score: 0
Accepted
time: 33ms
memory: 29244kb
Test #55:
score: 0
Accepted
time: 16ms
memory: 7124kb
Test #56:
score: 0
Accepted
time: 75ms
memory: 33240kb
Test #57:
score: 0
Accepted
time: 2ms
memory: 6528kb
Test #58:
score: 0
Accepted
time: 3ms
memory: 6440kb
Test #59:
score: 0
Accepted
time: 13ms
memory: 6544kb
Test #60:
score: 0
Accepted
time: 77ms
memory: 38364kb
Test #61:
score: 0
Accepted
time: 9ms
memory: 6440kb
Test #62:
score: 0
Accepted
time: 0ms
memory: 6540kb
Test #63:
score: 0
Accepted
time: 60ms
memory: 15200kb
Test #64:
score: 0
Accepted
time: 9ms
memory: 6528kb
Test #65:
score: 0
Accepted
time: 6ms
memory: 9480kb
Test #66:
score: 0
Accepted
time: 12ms
memory: 6556kb
Test #67:
score: 0
Accepted
time: 18ms
memory: 7672kb
Test #68:
score: 0
Accepted
time: 0ms
memory: 6580kb
Test #69:
score: 0
Accepted
time: 66ms
memory: 50864kb
Test #70:
score: 0
Accepted
time: 27ms
memory: 7588kb
Test #71:
score: 0
Accepted
time: 3ms
memory: 6440kb
Test #72:
score: 0
Accepted
time: 8ms
memory: 6536kb
Test #73:
score: 0
Accepted
time: 3ms
memory: 6492kb
Test #74:
score: 0
Accepted
time: 68ms
memory: 29520kb
Test #75:
score: 0
Accepted
time: 5ms
memory: 6604kb
Test #76:
score: 0
Accepted
time: 15ms
memory: 6816kb
Test #77:
score: 0
Accepted
time: 54ms
memory: 19048kb
Test #78:
score: 0
Accepted
time: 6ms
memory: 6536kb
Test #79:
score: 0
Accepted
time: 1ms
memory: 6588kb
Test #80:
score: -100
Wrong Answer
time: 6ms
memory: 6596kb