QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18064#2213. KnightYLiF4#WA 23ms10596kbC++14956b2022-01-16 09:19:532022-05-04 17:00:54

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-04 17:00:54]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:10596kb
  • [2022-01-16 09:19:53]
  • 提交

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},{-r,c},{-r,-c},c,r,-c,r,c,-r,-c,-r};
	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: 5ms
memory: 6284kb

Test #2:

score: 0
Accepted
time: 0ms
memory: 4436kb

Test #3:

score: 0
Accepted
time: 23ms
memory: 10596kb

Test #4:

score: 0
Accepted
time: 11ms
memory: 10188kb

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

score: 0
Accepted
time: 4ms
memory: 4636kb

Test #9:

score: 0
Accepted
time: 7ms
memory: 5604kb

Test #10:

score: 0
Accepted
time: 3ms
memory: 4720kb

Test #11:

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

Test #12:

score: 0
Accepted
time: 2ms
memory: 5852kb

Test #13:

score: -100
Wrong Answer
time: 8ms
memory: 7124kb