QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#17996#2213. Knightwxp#AC ✓77ms64040kbC++141.3kb2022-01-15 16:51:362022-05-04 16:36: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:36:27]
  • 评测
  • 测评结果:AC
  • 用时:77ms
  • 内存:64040kb
  • [2022-01-15 16:51:36]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define per(i,x,y) for(int i=x;i>=y;--i)
#define lon long long
using namespace std;
const int n7=1012;
const int dir[4][2]={{1,1},{1,-1},{-1,1},{-1,-1}};
int n,m,R,C,flag,typ[n7][n7];
char a[n7][n7];

int rd(){
	int shu=0;bool fu=0;char ch=getchar();
	while( !isdigit(ch) ){if(ch=='-')fu=1;ch=getchar();}
	while( isdigit(ch) )shu=(shu<<1)+(shu<<3)+ch-'0',ch=getchar();
	return fu?-shu:shu;
}

void dfs(int x,int y){
	if(a[x][y]^'B')flag++;
	rep(k,0,3){
		int xx=x+dir[k][0]*R,yy=y+dir[k][1]*C;
		if(xx<1||xx>n||yy<1||yy>m||~typ[xx][yy]||a[xx][yy]=='@')continue;
		typ[xx][yy]=!typ[x][y],dfs(xx,yy);
	}
	rep(k,0,3){
		int xx=x+dir[k][0]*C,yy=y+dir[k][1]*R;
		if(xx<1||xx>n||yy<1||yy>m||~typ[xx][yy]||a[xx][yy]=='@')continue;
		typ[xx][yy]=!typ[x][y],dfs(xx,yy);
	}
}

int main(){
	n=rd(),m=rd(),R=rd(),C=rd();
	rep(i,1,n)scanf("%s",a[i]+1);
	memset(typ,-1,sizeof typ);
	rep(i,1,n)rep(j,1,m){
		if(a[i][j]=='A'){typ[i][j]=0,dfs(i,j);break;}
	}
	if(flag==1){puts("Bob");return 0;}
	rep(i,1,n)rep(j,1,m){
		if(a[i][j]=='B'){
			if(typ[i][j]==-1){puts("Alice");return 0;}
			if(typ[i][j]==0){puts("Alice");return 0;}
			if(typ[i][j]==1){puts("Bob");return 0;}
		}
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 8760kb

Test #2:

score: 0
Accepted
time: 6ms
memory: 7832kb

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

score: 0
Accepted
time: 11ms
memory: 8416kb

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

score: 0
Accepted
time: 6ms
memory: 8384kb

Test #23:

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

Test #24:

score: 0
Accepted
time: 6ms
memory: 8716kb

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

score: 0
Accepted
time: 35ms
memory: 25736kb

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

score: 0
Accepted
time: 20ms
memory: 11208kb

Test #34:

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

Test #35:

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

Test #36:

score: 0
Accepted
time: 13ms
memory: 8864kb

Test #37:

score: 0
Accepted
time: 6ms
memory: 8068kb

Test #38:

score: 0
Accepted
time: 11ms
memory: 9656kb

Test #39:

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

Test #40:

score: 0
Accepted
time: 6ms
memory: 8244kb

Test #41:

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

Test #42:

score: 0
Accepted
time: 6ms
memory: 8704kb

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

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

Test #49:

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

Test #50:

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

Test #51:

score: 0
Accepted
time: 61ms
memory: 24612kb

Test #52:

score: 0
Accepted
time: 25ms
memory: 16684kb

Test #53:

score: 0
Accepted
time: 11ms
memory: 8624kb

Test #54:

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

Test #55:

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

Test #56:

score: 0
Accepted
time: 57ms
memory: 41840kb

Test #57:

score: 0
Accepted
time: 33ms
memory: 9788kb

Test #58:

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

Test #59:

score: 0
Accepted
time: 11ms
memory: 8712kb

Test #60:

score: 0
Accepted
time: 58ms
memory: 42900kb

Test #61:

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

Test #62:

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

Test #63:

score: 0
Accepted
time: 58ms
memory: 24420kb

Test #64:

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

Test #65:

score: 0
Accepted
time: 13ms
memory: 11872kb

Test #66:

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

Test #67:

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

Test #68:

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

Test #69:

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

Test #70:

score: 0
Accepted
time: 25ms
memory: 10852kb

Test #71:

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

Test #72:

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

Test #73:

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

Test #74:

score: 0
Accepted
time: 64ms
memory: 43672kb

Test #75:

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

Test #76:

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

Test #77:

score: 0
Accepted
time: 49ms
memory: 31556kb

Test #78:

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

Test #79:

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

Test #80:

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

Test #81:

score: 0
Accepted
time: 6ms
memory: 8648kb

Test #82:

score: 0
Accepted
time: 13ms
memory: 8672kb

Test #83:

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

Test #84:

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

Test #85:

score: 0
Accepted
time: 11ms
memory: 8724kb

Test #86:

score: 0
Accepted
time: 6ms
memory: 8628kb

Test #87:

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

Test #88:

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

Test #89:

score: 0
Accepted
time: 60ms
memory: 41564kb

Test #90:

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

Test #91:

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

Test #92:

score: 0
Accepted
time: 23ms
memory: 19640kb

Test #93:

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

Test #94:

score: 0
Accepted
time: 77ms
memory: 34904kb

Test #95:

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

Test #96:

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

Test #97:

score: 0
Accepted
time: 64ms
memory: 45536kb

Test #98:

score: 0
Accepted
time: 42ms
memory: 22980kb

Test #99:

score: 0
Accepted
time: 18ms
memory: 9928kb

Test #100:

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

Test #101:

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

Test #102:

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

Test #103:

score: 0
Accepted
time: 69ms
memory: 35500kb

Test #104:

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

Test #105:

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

Test #106:

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

Test #107:

score: 0
Accepted
time: 61ms
memory: 28168kb

Test #108:

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

Test #109:

score: 0
Accepted
time: 59ms
memory: 19196kb

Test #110:

score: 0
Accepted
time: 34ms
memory: 27144kb

Test #111:

score: 0
Accepted
time: 28ms
memory: 14268kb

Test #112:

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

Test #113:

score: 0
Accepted
time: 13ms
memory: 8668kb

Test #114:

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

Test #115:

score: 0
Accepted
time: 6ms
memory: 8728kb

Test #116:

score: 0
Accepted
time: 6ms
memory: 9360kb

Test #117:

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

Test #118:

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

Test #119:

score: 0
Accepted
time: 6ms
memory: 8624kb

Test #120:

score: 0
Accepted
time: 65ms
memory: 32032kb

Test #121:

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

Test #122:

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

Test #123:

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

Test #124:

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

Test #125:

score: 0
Accepted
time: 25ms
memory: 9784kb

Test #126:

score: 0
Accepted
time: 13ms
memory: 8624kb

Test #127:

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

Test #128:

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

Test #129:

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

Test #130:

score: 0
Accepted
time: 11ms
memory: 10396kb

Test #131:

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

Test #132:

score: 0
Accepted
time: 36ms
memory: 26208kb

Test #133:

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

Test #134:

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

Test #135:

score: 0
Accepted
time: 69ms
memory: 48688kb

Test #136:

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

Test #137:

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

Test #138:

score: 0
Accepted
time: 45ms
memory: 48992kb

Test #139:

score: 0
Accepted
time: 13ms
memory: 8612kb

Test #140:

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

Test #141:

score: 0
Accepted
time: 24ms
memory: 16772kb

Test #142:

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

Test #143:

score: 0
Accepted
time: 48ms
memory: 50800kb

Test #144:

score: 0
Accepted
time: 13ms
memory: 10976kb

Test #145:

score: 0
Accepted
time: 17ms
memory: 15084kb

Test #146:

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

Test #147:

score: 0
Accepted
time: 17ms
memory: 21732kb

Test #148:

score: 0
Accepted
time: 63ms
memory: 27176kb

Test #149:

score: 0
Accepted
time: 27ms
memory: 10500kb

Test #150:

score: 0
Accepted
time: 42ms
memory: 35372kb

Test #151:

score: 0
Accepted
time: 51ms
memory: 64040kb

Test #152:

score: 0
Accepted
time: 6ms
memory: 8732kb

Test #153:

score: 0
Accepted
time: 13ms
memory: 8784kb

Test #154:

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

Test #155:

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

Test #156:

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

Test #157:

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

Test #158:

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

Test #159:

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

Test #160:

score: 0
Accepted
time: 11ms
memory: 8708kb

Test #161:

score: 0
Accepted
time: 35ms
memory: 14688kb

Test #162:

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

Test #163:

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

Test #164:

score: 0
Accepted
time: 31ms
memory: 14784kb

Test #165:

score: 0
Accepted
time: 25ms
memory: 27924kb

Test #166:

score: 0
Accepted
time: 58ms
memory: 33884kb