QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61026#2213. Knightcrazy_seaWA 9ms4872kbC++11783b2022-11-09 09:27:272022-11-09 09:27:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-09 09:27:30]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:4872kb
  • [2022-11-09 09:27:27]
  • 提交

answer

#include<cstdio>
#include<vector>
using namespace std;
const int N=1e3+10;
char str[N];
int n,m,x1,y1,x2,y2,r,c;
bool vis[N][N],p[N][N],col[N][N];
vector<int> f1,f2;
bool chk(int x,int y)
{
	if(x<1||y<1||x>n||y>m||p[x][y]) return 0;
	return !vis[x][y];
}
void dfs(int x,int y)
{
	vis[x][y]=1;
	for(int i=0;i<8;i++)
		if(chk(x+f1[i],y+f2[i]))
			col[x+f1[i]][y+f2[i]]=!col[x][y],dfs(x+f1[i],y+f2[i]);
}
int main()
{
	scanf("%d%d%d%d",&n,&m,&r,&c);
	f1={-r,-c,c,r,r,c,-c,-r},f2={c,r,r,c,-c,-r,-r,-c};
	for(int i=1;i<=n;i++)
	{
		scanf("%s",str);
		for(int j=1;j<=m;j++)
			if(str[j-1]=='A') x1=i,y1=j;
			else if(str[j-1]=='B') x2=i,y2=j;
			else if(str[j-1]=='@') p[i][j]=1;
	}
	dfs(x1,y1);
	printf("%s",!vis[x2][y2]||col[x2][y2]==0?"Alice":"Bob");
}

Details

Test #1:

score: 0
Wrong Answer
time: 9ms
memory: 4872kb