QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#17933#2213. Knightqingyu_orzAC ✓669ms130700kbC++141.4kb2022-01-15 12:59:242022-05-04 16:27:50

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:27:50]
  • 评测
  • 测评结果:AC
  • 用时:669ms
  • 内存:130700kb
  • [2022-01-15 12:59:24]
  • 提交

answer

#include<bits/stdc++.h>
#define mk(x,y) ((x-1)*m+y)
using namespace std;
char s[1005][1005];
vector<int>g[1000005];
int mb[8][2];
int col[1000005];
void dfs(int x){
	for(auto cu:g[x]){
		if(col[cu]){
			continue;
		}
		col[cu]=-col[x];
		dfs(cu);
	}
}
int main(){
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	int f1=1,f2=1;
	for(int i=1;i<=n;++i){
		scanf("%s",s[i]+1);
		assert(strlen(s[i]+1)==m);
	}
	if(!(f1&f2)){
		puts("yangxiaorui");
		puts("hacked");
		puts("qingyu.blog");
		return 0;
	}
	mb[0][0]=x,mb[0][1]=y;
	mb[1][0]=-x,mb[1][1]=y;
	mb[2][0]=x,mb[2][1]=-y;
	mb[3][0]=-x,mb[3][1]=-y;
	mb[4][0]=y,mb[4][1]=x;
	mb[5][0]=-y,mb[5][1]=x;
	mb[6][0]=y,mb[6][1]=-x;
	mb[7][0]=-y,mb[7][1]=-x;
	for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)
		if(s[i][j]!='@'){
			for(int k=0;k<8;++k){
				int dx=i+mb[k][0],dy=j+mb[k][1];
				if(dx<1||dy<1||dx>n||dy>m)continue;
				if(s[dx][dy]=='@')continue;
				int u=mk(i,j),v=mk(dx,dy);
				g[u].emplace_back(v);
				g[v].emplace_back(u);
			}
		}
	int A=-1,B=-1;
	for(int i=1;i<=n;++i)for(int j=1;j<=m;++j){
		if(s[i][j]=='A')A=mk(i,j);
		else if(s[i][j]=='B')B=mk(i,j);
	}
	if(!g[A].size()){
		puts("Bob");
		return 0;
	}
	int N=mk(n,m);
	for(int i=1;i<=N;++i)if(!col[i]){
		col[i]=i;
		dfs(i);
	}
	if(abs(col[A])!=abs(col[B]))puts("Alice");
	else if(col[A]==col[B])puts("Alice");
	else puts("Bob");
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 61ms
memory: 44068kb

Test #2:

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

Test #3:

score: 0
Accepted
time: 338ms
memory: 61168kb

Test #4:

score: 0
Accepted
time: 134ms
memory: 43328kb

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

score: 0
Accepted
time: 137ms
memory: 51176kb

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

score: 0
Accepted
time: 169ms
memory: 62948kb

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

score: 0
Accepted
time: 213ms
memory: 53912kb

Test #34:

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

Test #35:

score: 0
Accepted
time: 174ms
memory: 54128kb

Test #36:

score: 0
Accepted
time: 284ms
memory: 55000kb

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

score: 0
Accepted
time: 179ms
memory: 49544kb

Test #49:

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

Test #50:

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

Test #51:

score: 0
Accepted
time: 413ms
memory: 76824kb

Test #52:

score: 0
Accepted
time: 434ms
memory: 80244kb

Test #53:

score: 0
Accepted
time: 78ms
memory: 37652kb

Test #54:

score: 0
Accepted
time: 581ms
memory: 111940kb

Test #55:

score: 0
Accepted
time: 278ms
memory: 54288kb

Test #56:

score: 0
Accepted
time: 658ms
memory: 104608kb

Test #57:

score: 0
Accepted
time: 237ms
memory: 53276kb

Test #58:

score: 0
Accepted
time: 26ms
memory: 32124kb

Test #59:

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

Test #60:

score: 0
Accepted
time: 650ms
memory: 108744kb

Test #61:

score: 0
Accepted
time: 226ms
memory: 50760kb

Test #62:

score: 0
Accepted
time: 170ms
memory: 43568kb

Test #63:

score: 0
Accepted
time: 475ms
memory: 80824kb

Test #64:

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

Test #65:

score: 0
Accepted
time: 605ms
memory: 106012kb

Test #66:

score: 0
Accepted
time: 81ms
memory: 37228kb

Test #67:

score: 0
Accepted
time: 328ms
memory: 61504kb

Test #68:

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

Test #69:

score: 0
Accepted
time: 635ms
memory: 114080kb

Test #70:

score: 0
Accepted
time: 165ms
memory: 46128kb

Test #71:

score: 0
Accepted
time: 154ms
memory: 46488kb

Test #72:

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

Test #73:

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

Test #74:

score: 0
Accepted
time: 620ms
memory: 106640kb

Test #75:

score: 0
Accepted
time: 266ms
memory: 58720kb

Test #76:

score: 0
Accepted
time: 345ms
memory: 63368kb

Test #77:

score: 0
Accepted
time: 476ms
memory: 92040kb

Test #78:

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

Test #79:

score: 0
Accepted
time: 84ms
memory: 39440kb

Test #80:

score: 0
Accepted
time: 316ms
memory: 59932kb

Test #81:

score: 0
Accepted
time: 243ms
memory: 57560kb

Test #82:

score: 0
Accepted
time: 268ms
memory: 55336kb

Test #83:

score: 0
Accepted
time: 124ms
memory: 49012kb

Test #84:

score: 0
Accepted
time: 118ms
memory: 42248kb

Test #85:

score: 0
Accepted
time: 70ms
memory: 36656kb

Test #86:

score: 0
Accepted
time: 52ms
memory: 36740kb

Test #87:

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

Test #88:

score: 0
Accepted
time: 53ms
memory: 36820kb

Test #89:

score: 0
Accepted
time: 583ms
memory: 106592kb

Test #90:

score: 0
Accepted
time: 263ms
memory: 55892kb

Test #91:

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

Test #92:

score: 0
Accepted
time: 534ms
memory: 97664kb

Test #93:

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

Test #94:

score: 0
Accepted
time: 571ms
memory: 95252kb

Test #95:

score: 0
Accepted
time: 392ms
memory: 94816kb

Test #96:

score: 0
Accepted
time: 278ms
memory: 61256kb

Test #97:

score: 0
Accepted
time: 463ms
memory: 101280kb

Test #98:

score: 0
Accepted
time: 416ms
memory: 82088kb

Test #99:

score: 0
Accepted
time: 434ms
memory: 78876kb

Test #100:

score: 0
Accepted
time: 447ms
memory: 89880kb

Test #101:

score: 0
Accepted
time: 564ms
memory: 104748kb

Test #102:

score: 0
Accepted
time: 496ms
memory: 101240kb

Test #103:

score: 0
Accepted
time: 552ms
memory: 96016kb

Test #104:

score: 0
Accepted
time: 173ms
memory: 44128kb

Test #105:

score: 0
Accepted
time: 376ms
memory: 77480kb

Test #106:

score: 0
Accepted
time: 181ms
memory: 53632kb

Test #107:

score: 0
Accepted
time: 484ms
memory: 90772kb

Test #108:

score: 0
Accepted
time: 627ms
memory: 108752kb

Test #109:

score: 0
Accepted
time: 356ms
memory: 66520kb

Test #110:

score: 0
Accepted
time: 654ms
memory: 98360kb

Test #111:

score: 0
Accepted
time: 386ms
memory: 68164kb

Test #112:

score: 0
Accepted
time: 567ms
memory: 92496kb

Test #113:

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

Test #114:

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

Test #115:

score: 0
Accepted
time: 89ms
memory: 38048kb

Test #116:

score: 0
Accepted
time: 530ms
memory: 93476kb

Test #117:

score: 0
Accepted
time: 669ms
memory: 107972kb

Test #118:

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

Test #119:

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

Test #120:

score: 0
Accepted
time: 336ms
memory: 78252kb

Test #121:

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

Test #122:

score: 0
Accepted
time: 110ms
memory: 52040kb

Test #123:

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

Test #124:

score: 0
Accepted
time: 95ms
memory: 39660kb

Test #125:

score: 0
Accepted
time: 241ms
memory: 51936kb

Test #126:

score: 0
Accepted
time: 53ms
memory: 36412kb

Test #127:

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

Test #128:

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

Test #129:

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

Test #130:

score: 0
Accepted
time: 388ms
memory: 75568kb

Test #131:

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

Test #132:

score: 0
Accepted
time: 311ms
memory: 67560kb

Test #133:

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

Test #134:

score: 0
Accepted
time: 131ms
memory: 46572kb

Test #135:

score: 0
Accepted
time: 572ms
memory: 108860kb

Test #136:

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

Test #137:

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

Test #138:

score: 0
Accepted
time: 580ms
memory: 115256kb

Test #139:

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

Test #140:

score: 0
Accepted
time: 129ms
memory: 48828kb

Test #141:

score: 0
Accepted
time: 578ms
memory: 91356kb

Test #142:

score: 0
Accepted
time: 78ms
memory: 39544kb

Test #143:

score: 0
Accepted
time: 623ms
memory: 115232kb

Test #144:

score: 0
Accepted
time: 305ms
memory: 59576kb

Test #145:

score: 0
Accepted
time: 328ms
memory: 74044kb

Test #146:

score: 0
Accepted
time: 148ms
memory: 45344kb

Test #147:

score: 0
Accepted
time: 610ms
memory: 111148kb

Test #148:

score: 0
Accepted
time: 530ms
memory: 92612kb

Test #149:

score: 0
Accepted
time: 331ms
memory: 66716kb

Test #150:

score: 0
Accepted
time: 507ms
memory: 97976kb

Test #151:

score: 0
Accepted
time: 540ms
memory: 130700kb

Test #152:

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

Test #153:

score: 0
Accepted
time: 32ms
memory: 34504kb

Test #154:

score: 0
Accepted
time: 82ms
memory: 38480kb

Test #155:

score: 0
Accepted
time: 447ms
memory: 88664kb

Test #156:

score: 0
Accepted
time: 112ms
memory: 44780kb

Test #157:

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

Test #158:

score: 0
Accepted
time: 194ms
memory: 52860kb

Test #159:

score: 0
Accepted
time: 26ms
memory: 31484kb

Test #160:

score: 0
Accepted
time: 72ms
memory: 37044kb

Test #161:

score: 0
Accepted
time: 175ms
memory: 48672kb

Test #162:

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

Test #163:

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

Test #164:

score: 0
Accepted
time: 353ms
memory: 65104kb

Test #165:

score: 0
Accepted
time: 660ms
memory: 103640kb

Test #166:

score: 0
Accepted
time: 432ms
memory: 84844kb