QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#17932#2213. Knightqingyu_orzAC ✓778ms130796kbC++141.4kb2022-01-15 12:57:472022-05-04 16:26:59

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:26:59]
  • 评测
  • 测评结果:AC
  • 用时:778ms
  • 内存:130796kb
  • [2022-01-15 12:57:47]
  • 提交

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=0,f2=0;
	for(int i=1;i<=n;++i){
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;++j){
			f1|=s[i][j]=='A';
			f2|=s[i][j]=='B';
		}
	}
	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()||g[A][0]==B){
		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: 73ms
memory: 43932kb

Test #2:

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

Test #3:

score: 0
Accepted
time: 285ms
memory: 60060kb

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

score: 0
Accepted
time: 46ms
memory: 37516kb

Test #10:

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

Test #11:

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

Test #12:

score: 0
Accepted
time: 150ms
memory: 50008kb

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

score: 0
Accepted
time: 16ms
memory: 29408kb

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

score: 0
Accepted
time: 187ms
memory: 61304kb

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

score: 0
Accepted
time: 223ms
memory: 55572kb

Test #34:

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

Test #35:

score: 0
Accepted
time: 197ms
memory: 52428kb

Test #36:

score: 0
Accepted
time: 273ms
memory: 54928kb

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

score: 0
Accepted
time: 231ms
memory: 49184kb

Test #49:

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

Test #50:

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

Test #51:

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

Test #52:

score: 0
Accepted
time: 526ms
memory: 80348kb

Test #53:

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

Test #54:

score: 0
Accepted
time: 679ms
memory: 111996kb

Test #55:

score: 0
Accepted
time: 303ms
memory: 54300kb

Test #56:

score: 0
Accepted
time: 632ms
memory: 104492kb

Test #57:

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

Test #58:

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

Test #59:

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

Test #60:

score: 0
Accepted
time: 674ms
memory: 108956kb

Test #61:

score: 0
Accepted
time: 239ms
memory: 50876kb

Test #62:

score: 0
Accepted
time: 158ms
memory: 43528kb

Test #63:

score: 0
Accepted
time: 486ms
memory: 81048kb

Test #64:

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

Test #65:

score: 0
Accepted
time: 716ms
memory: 106000kb

Test #66:

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

Test #67:

score: 0
Accepted
time: 363ms
memory: 61588kb

Test #68:

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

Test #69:

score: 0
Accepted
time: 721ms
memory: 114152kb

Test #70:

score: 0
Accepted
time: 222ms
memory: 46124kb

Test #71:

score: 0
Accepted
time: 176ms
memory: 46424kb

Test #72:

score: 0
Accepted
time: 80ms
memory: 35728kb

Test #73:

score: 0
Accepted
time: 75ms
memory: 48084kb

Test #74:

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

Test #75:

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

Test #76:

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

Test #77:

score: 0
Accepted
time: 512ms
memory: 92236kb

Test #78:

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

Test #79:

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

Test #80:

score: 0
Accepted
time: 313ms
memory: 60020kb

Test #81:

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

Test #82:

score: 0
Accepted
time: 254ms
memory: 55448kb

Test #83:

score: 0
Accepted
time: 128ms
memory: 50524kb

Test #84:

score: 0
Accepted
time: 122ms
memory: 42288kb

Test #85:

score: 0
Accepted
time: 85ms
memory: 36616kb

Test #86:

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

Test #87:

score: 0
Accepted
time: 75ms
memory: 40660kb

Test #88:

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

Test #89:

score: 0
Accepted
time: 641ms
memory: 106508kb

Test #90:

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

Test #91:

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

Test #92:

score: 0
Accepted
time: 591ms
memory: 97716kb

Test #93:

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

Test #94:

score: 0
Accepted
time: 557ms
memory: 95056kb

Test #95:

score: 0
Accepted
time: 430ms
memory: 94896kb

Test #96:

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

Test #97:

score: 0
Accepted
time: 466ms
memory: 101276kb

Test #98:

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

Test #99:

score: 0
Accepted
time: 437ms
memory: 78816kb

Test #100:

score: 0
Accepted
time: 489ms
memory: 89972kb

Test #101:

score: 0
Accepted
time: 649ms
memory: 104636kb

Test #102:

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

Test #103:

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

Test #104:

score: 0
Accepted
time: 164ms
memory: 44096kb

Test #105:

score: 0
Accepted
time: 393ms
memory: 77432kb

Test #106:

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

Test #107:

score: 0
Accepted
time: 494ms
memory: 90760kb

Test #108:

score: 0
Accepted
time: 604ms
memory: 108620kb

Test #109:

score: 0
Accepted
time: 344ms
memory: 66620kb

Test #110:

score: 0
Accepted
time: 647ms
memory: 98364kb

Test #111:

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

Test #112:

score: 0
Accepted
time: 599ms
memory: 92412kb

Test #113:

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

Test #114:

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

Test #115:

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

Test #116:

score: 0
Accepted
time: 519ms
memory: 93420kb

Test #117:

score: 0
Accepted
time: 666ms
memory: 107992kb

Test #118:

score: 0
Accepted
time: 39ms
memory: 34120kb

Test #119:

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

Test #120:

score: 0
Accepted
time: 398ms
memory: 78052kb

Test #121:

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

Test #122:

score: 0
Accepted
time: 85ms
memory: 49912kb

Test #123:

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

Test #124:

score: 0
Accepted
time: 87ms
memory: 39752kb

Test #125:

score: 0
Accepted
time: 246ms
memory: 51856kb

Test #126:

score: 0
Accepted
time: 75ms
memory: 36316kb

Test #127:

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

Test #128:

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

Test #129:

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

Test #130:

score: 0
Accepted
time: 421ms
memory: 75760kb

Test #131:

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

Test #132:

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

Test #133:

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

Test #134:

score: 0
Accepted
time: 160ms
memory: 46416kb

Test #135:

score: 0
Accepted
time: 655ms
memory: 108836kb

Test #136:

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

Test #137:

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

Test #138:

score: 0
Accepted
time: 585ms
memory: 115224kb

Test #139:

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

Test #140:

score: 0
Accepted
time: 127ms
memory: 48856kb

Test #141:

score: 0
Accepted
time: 639ms
memory: 91380kb

Test #142:

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

Test #143:

score: 0
Accepted
time: 747ms
memory: 115236kb

Test #144:

score: 0
Accepted
time: 381ms
memory: 59684kb

Test #145:

score: 0
Accepted
time: 375ms
memory: 74072kb

Test #146:

score: 0
Accepted
time: 255ms
memory: 45268kb

Test #147:

score: 0
Accepted
time: 665ms
memory: 111092kb

Test #148:

score: 0
Accepted
time: 586ms
memory: 92624kb

Test #149:

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

Test #150:

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

Test #151:

score: 0
Accepted
time: 641ms
memory: 130796kb

Test #152:

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

Test #153:

score: 0
Accepted
time: 39ms
memory: 33492kb

Test #154:

score: 0
Accepted
time: 85ms
memory: 39564kb

Test #155:

score: 0
Accepted
time: 559ms
memory: 88620kb

Test #156:

score: 0
Accepted
time: 121ms
memory: 44676kb

Test #157:

score: 0
Accepted
time: 86ms
memory: 51384kb

Test #158:

score: 0
Accepted
time: 233ms
memory: 52952kb

Test #159:

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

Test #160:

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

Test #161:

score: 0
Accepted
time: 201ms
memory: 48516kb

Test #162:

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

Test #163:

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

Test #164:

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

Test #165:

score: 0
Accepted
time: 778ms
memory: 103740kb

Test #166:

score: 0
Accepted
time: 575ms
memory: 84856kb