QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18018#2213. Knightzrt#WA 5ms7200kbC++111.0kb2022-01-15 18:34:432022-05-04 16:41:27

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:27]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:7200kb
  • [2022-01-15 18:34: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;
			if(!vis[i][j])dfs(i,j,tot+=2);
			if(s[i][j]=='A')cun1=vis[i][j];
			if(s[i][j]=='B')cun2=vis[i][j];
		}
//	cout<<cun1<<" "<<cun2<<endl;
	if(cun1!=cun2&&(cun1^1)!=cun2){
		puts("Alice");
	}else if(cun1==cun2){
		puts("Alice");
	}else puts("Bob");
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 5ms
memory: 7200kb