QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#17985#2213. Knight_silhouette_#WA 136ms51952kbC++1.4kb2022-01-15 16:00:432022-05-04 16:34:55

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:34:55]
  • 评测
  • 测评结果:WA
  • 用时:136ms
  • 内存:51952kb
  • [2022-01-15 16:00:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAX=1e3;
const int fx[4]={1,1,-1,-1};
const int fy[4]={1,-1,1,-1};
int n,m,r,c,Num,tot,lin[MAX*MAX+5],vis[MAX*MAX+5],Dep[MAX*MAX+5];
char mp[MAX+5][MAX+5];
struct Edge{
	int Id,Next;
} e[MAX*MAX*32+5];
int Id(int x,int y){
	return (x-1)*m+y;
}
void Insert(int x,int y){
	e[++Num].Next=lin[x]; lin[x]=Num; e[Num].Id=y;
}
void dfs(int x){
	vis[x]=1; ++tot;
	for(int i=lin[x];i;i=e[i].Next){
		if(vis[e[i].Id]) continue;
		Dep[e[i].Id]=Dep[x]^1;
		dfs(e[i].Id);
	}
}
bool In(int x,int y){
	return x>=1&&x<=n&&y>=1&&y<=m;
}
int main(){
	scanf("%d%d%d%d",&n,&m,&r,&c);
	for(int i=1;i<=n;i++) scanf("%s",mp[i]+1);
	for(int i=1;i<=n;i++)
	 for(int j=1;j<=n;j++)
	  if(mp[i][j]!='@')
	   for(int k=0;k<4;k++){
	   	if(In(i+fx[k]*r,j+fy[k]*c)&&mp[i+fx[k]*r][j+fy[k]*c]!='@')
	   	 Insert(Id(i,j),Id(i+fx[k]*r,j+fy[k]*c)),
		 Insert(Id(i+fx[k]*r,j+fy[k]*c),Id(i,j)); 
		if(In(i+fx[k]*c,j+fy[k]*r)&&mp[i+fx[k]*c][j+fy[k]*r]!='@')
		 Insert(Id(i,j),Id(i+fx[k]*c,j+fy[k]*r)),
		 Insert(Id(i+fx[k]*c,j+fy[k]*r),Id(i,j)); 
	   }
	int sx=0,sy=0,ex=0,ey=0;
	for(int i=1;i<=n;i++)
	 for(int j=1;j<=m;j++){
		if(mp[i][j]=='A') sx=i,sy=j;
		if(mp[i][j]=='B') ex=i,ey=j;
	 }
	dfs(Id(sx,sy));
	if(tot==1) puts("Bob");
	else if(!vis[Id(ex,ey)]) puts("Alice");
	else {
		if(Dep[Id(ex,ey)]) puts("Bob");
		else puts("Alice");
	}
	return 0;
} 

详细

Test #1:

score: 100
Accepted
time: 11ms
memory: 22904kb

Test #2:

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

Test #3:

score: 0
Accepted
time: 68ms
memory: 41800kb

Test #4:

score: 0
Accepted
time: 40ms
memory: 30892kb

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

score: 0
Accepted
time: 10ms
memory: 17948kb

Test #10:

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

Test #11:

score: 0
Accepted
time: 5ms
memory: 15252kb

Test #12:

score: 0
Accepted
time: 9ms
memory: 32016kb

Test #13:

score: 0
Accepted
time: 19ms
memory: 22348kb

Test #14:

score: 0
Accepted
time: 9ms
memory: 26316kb

Test #15:

score: 0
Accepted
time: 15ms
memory: 19544kb

Test #16:

score: 0
Accepted
time: 8ms
memory: 16832kb

Test #17:

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

Test #18:

score: 0
Accepted
time: 8ms
memory: 16460kb

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

score: 0
Accepted
time: 14ms
memory: 14112kb

Test #25:

score: 0
Accepted
time: 12ms
memory: 17096kb

Test #26:

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

Test #27:

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

Test #28:

score: 0
Accepted
time: 136ms
memory: 51952kb

Test #29:

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

Test #30:

score: 0
Accepted
time: 14ms
memory: 20952kb

Test #31:

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

Test #32:

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

Test #33:

score: 0
Accepted
time: 101ms
memory: 42280kb

Test #34:

score: -100
Wrong Answer
time: 10ms
memory: 16916kb