QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18015#2213. Knightzrt#WA 12ms7484kbC++111017b2022-01-15 18:30:432022-05-04 16:41:16

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 16:41:16]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:7484kb
  • [2022-01-15 18:30:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,r,c;
char s[1010][1010];
int vis[1010][1010];
bool check(int x,int y){
	if(x<=n&&x>=1&&y<=m&&y>=1&&!vis[x][y]&&s[x][y]!='@')return true;
	return false;
}
void dfs(int x,int y,int v){
	vis[x][y]=v;
	if(check(x+r,y+c))dfs(x+r,y+c,v^1);
	if(check(x+r,y-c))dfs(x+r,y-c,v^1);
	if(check(x-r,y+c))dfs(x-r,y+c,v^1);
	if(check(x-r,y-c))dfs(x-r,y-c,v^1);
	swap(r,c);
	if(check(x+r,y+c))dfs(x+r,y+c,v^1);
	if(check(x+r,y-c))dfs(x+r,y-c,v^1);
	if(check(x-r,y+c))dfs(x-r,y+c,v^1);
	if(check(x-r,y-c))dfs(x-r,y-c,v^1);
	swap(r,c);
	return ;
}
int main(){
	scanf("%d%d%d%d",&n,&m,&r,&c);
	for(int i=1;i<=n;i++)
		scanf("%s",s[i]+1);
	int tot=1,cun1=0,cun2=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if(s[i][j]=='@')continue;
			dfs(i,j,tot+=2);
			if(s[i][j]=='A')cun1=vis[i][j];
			if(s[i][j]=='B')cun2=vis[i][j];
		}
	if(cun1!=cun2&&cun1^1!=cun2){
		puts("Alice");
	}else if(cun1==cun2){
		puts("Alice");
	}else puts("Bob");
}

详细

Test #1:

score: 0
Wrong Answer
time: 12ms
memory: 7484kb