QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#18016#2213. Knightzrt#WA 7ms7844kbC++111.0kb2022-01-15 18:32:362022-05-04 16:41:18

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:18]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:7844kb
  • [2022-01-15 18:32:36]
  • 提交

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: 7ms
memory: 7844kb