QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#18205#2213. KnightAppleblue17#AC ✓90ms51024kbC++840b2022-01-16 19:30:142022-05-04 17:20:25

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 17:20:25]
  • 评测
  • 测评结果:AC
  • 用时:90ms
  • 内存:51024kb
  • [2022-01-16 19:30:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1100;
int n,m,r,c,x,y,X,Y,cnt;
char S[N][N];
int col[N][N];
void dfs(int x,int y,int w){
	if(x<1 || x>n || y<1 || y>m || S[x][y]=='@' || col[x][y]!=-1) return ;
	col[x][y]=w;
	cnt++;
	dfs(x-r,y-c,w^1);
	dfs(x-r,y+c,w^1);
	dfs(x+r,y-c,w^1);
	dfs(x+r,y+c,w^1);
	dfs(x-c,y-r,w^1);
	dfs(x-c,y+r,w^1);
	dfs(x+c,y-r,w^1);
	dfs(x+c,y+r,w^1);
}

int main(){
	cin>>n>>m>>r>>c;
	for(int i=1;i<=n;i++){
		scanf("\n%s",S[i]+1);
		for(int j=1;j<=m;j++){
			if(S[i][j]=='A') x=i,y=j;
			if(S[i][j]=='B') X=i,Y=j;
		}
	}
	memset(col,-1,sizeof(col));
	dfs(x,y,0);
//	for(int i=1;i<=n;i++){
//		for(int j=1;j<=m;j++){
//			cout<<col[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	if(cnt>1 && (col[X][Y]==-1 || col[X][Y]==col[x][y])) puts("Alice");
	else puts("Bob");
}

Details

Test #1:

score: 100
Accepted
time: 5ms
memory: 9528kb

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

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

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

score: 0
Accepted
time: 22ms
memory: 22176kb

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

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

Test #34:

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

Test #35:

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

Test #36:

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

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

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

Test #49:

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

Test #50:

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

Test #51:

score: 0
Accepted
time: 66ms
memory: 21476kb

Test #52:

score: 0
Accepted
time: 21ms
memory: 15476kb

Test #53:

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

Test #54:

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

Test #55:

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

Test #56:

score: 0
Accepted
time: 76ms
memory: 34276kb

Test #57:

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

Test #58:

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

Test #59:

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

Test #60:

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

Test #61:

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

Test #62:

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

Test #63:

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

Test #64:

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

Test #65:

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

Test #66:

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

Test #67:

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

Test #68:

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

Test #69:

score: 0
Accepted
time: 50ms
memory: 42632kb

Test #70:

score: 0
Accepted
time: 22ms
memory: 11080kb

Test #71:

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

Test #72:

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

Test #73:

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

Test #74:

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

Test #75:

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

Test #76:

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

Test #77:

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

Test #78:

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

Test #79:

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

Test #80:

score: 0
Accepted
time: 38ms
memory: 11276kb

Test #81:

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

Test #82:

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

Test #83:

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

Test #84:

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

Test #85:

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

Test #86:

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

Test #87:

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

Test #88:

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

Test #89:

score: 0
Accepted
time: 90ms
memory: 34092kb

Test #90:

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

Test #91:

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

Test #92:

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

Test #93:

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

Test #94:

score: 0
Accepted
time: 74ms
memory: 28944kb

Test #95:

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

Test #96:

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

Test #97:

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

Test #98:

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

Test #99:

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

Test #100:

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

Test #101:

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

Test #102:

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

Test #103:

score: 0
Accepted
time: 62ms
memory: 28892kb

Test #104:

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

Test #105:

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

Test #106:

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

Test #107:

score: 0
Accepted
time: 73ms
memory: 23696kb

Test #108:

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

Test #109:

score: 0
Accepted
time: 56ms
memory: 17132kb

Test #110:

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

Test #111:

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

Test #112:

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

Test #113:

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

Test #114:

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

Test #115:

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

Test #116:

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

Test #117:

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

Test #118:

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

Test #119:

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

Test #120:

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

Test #121:

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

Test #122:

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

Test #123:

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

Test #124:

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

Test #125:

score: 0
Accepted
time: 37ms
memory: 10308kb

Test #126:

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

Test #127:

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

Test #128:

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

Test #129:

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

Test #130:

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

Test #131:

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

Test #132:

score: 0
Accepted
time: 54ms
memory: 22916kb

Test #133:

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

Test #134:

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

Test #135:

score: 0
Accepted
time: 90ms
memory: 39072kb

Test #136:

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

Test #137:

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

Test #138:

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

Test #139:

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

Test #140:

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

Test #141:

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

Test #142:

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

Test #143:

score: 0
Accepted
time: 55ms
memory: 41276kb

Test #144:

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

Test #145:

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

Test #146:

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

Test #147:

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

Test #148:

score: 0
Accepted
time: 43ms
memory: 22720kb

Test #149:

score: 0
Accepted
time: 21ms
memory: 10972kb

Test #150:

score: 0
Accepted
time: 47ms
memory: 29008kb

Test #151:

score: 0
Accepted
time: 44ms
memory: 51024kb

Test #152:

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

Test #153:

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

Test #154:

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

Test #155:

score: 0
Accepted
time: 67ms
memory: 31192kb

Test #156:

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

Test #157:

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

Test #158:

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

Test #159:

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

Test #160:

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

Test #161:

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

Test #162:

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

Test #163:

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

Test #164:

score: 0
Accepted
time: 29ms
memory: 13848kb

Test #165:

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

Test #166:

score: 0
Accepted
time: 66ms
memory: 28716kb