QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#23489#2213. KnightThe_NobodyWA 5ms10968kbC++141.7kb2022-03-16 19:28:202022-04-30 03:16:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 03:16:53]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:10968kb
  • [2022-03-16 19:28:20]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define Il inline
#define Re register
#define mem(u,v) memset(u,v,sizeof(u))
#define rep(i,a,b) for(Re ll i=(a),KKK##i=(b);i<=KKK##i;i++)
#define drep(i,a,b) for(Re ll i=(a),KKK##i=(b);i>=KKK##i;i--)
#define go(u) for(ll i=head[u],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define _go(u) for(ll i=Head[u],v=E[i].to;i;i=E[i].nxt,v=E[i].to)
#define __go(u) for(ll i=Head[u],v=e[i].to;i;i=e[i].nxt,v=e[i].to)
#define writesp(x) write(x),putchar(' ')
#define writeln(x) write(x),puts("")
using namespace std;
//#define getchar nc
inline char nc(){static char buf[10000000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,10000000,stdin),p1==p2)?EOF:*p1++;}
Il ll read(){ll sum=0,f=0;char ch=getchar();for(;!isdigit(ch);ch=getchar())f|=(ch=='-');for(;isdigit(ch);ch=getchar())sum=((sum<<1)+(sum<<3)+(ch^48));return f?-sum:sum;}
void write(const ll x){if(x<0){putchar('-');write(-x);return;}if(x>9)write(x/10);putchar(x%10+'0');}
char getc(){char c=getchar();while(c!='@'&&c!='.'&&c!='A'&&c!='B')c=getchar();return c;}
#define N 1100
ll n,m,a,b,col[N][N],ax,ay,bx,by;char g[N][N];
void dfs(ll x,ll y,ll w){
	if(x<=0||x>n||y<=0||y>m)return;
	if(col[x][y]!=-1||g[x][y]=='@')return;
	col[x][y]=w;
	dfs(x+a,y+b,w^1);
	dfs(x-a,y+b,w^1);
	dfs(x+a,y-b,w^1);
	dfs(x-a,y-b,w^1);
	dfs(x+b,y+a,w^1);
	dfs(x-b,y+a,w^1);
	dfs(x+b,y-a,w^1);
	dfs(x-b,y-a,w^1);
}
int main(){
	n=read(),m=read();a=read(),b=read();
	rep(i,1,n){
		rep(j,1,m){
			g[i][j]=getc();
			if(g[i][j]=='A')ax=i,ay=j;
			if(g[i][j]=='B')bx=i,by=j;
		}
	}
	rep(i,1,n)rep(j,1,m)col[i][j]=-1;
	dfs(ax,ay,0);
	if(col[bx][by]==-1)puts("Alice");
	else if(col[bx][by]==col[ax][ay])puts("Alice");
	else puts("Bob");
}

详细

Test #1:

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