QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61027#2213. Knightcrazy_seaAC ✓89ms63064kbC++11802b2022-11-09 09:29:022022-11-09 09:29:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-09 09:29:04]
  • 评测
  • 测评结果:AC
  • 用时:89ms
  • 内存:63064kb
  • [2022-11-09 09:29:02]
  • 提交

answer

#include<cstdio>
#include<vector>
using namespace std;
const int N=1e3+10;
char str[N];
int n,m,x1,y1,x2,y2,r,c,cnt;
bool vis[N][N],p[N][N],col[N][N];
vector<int> f1,f2;
bool chk(int x,int y)
{
	if(x<1||y<1||x>n||y>m||p[x][y]) return 0;
	return !vis[x][y];
}
void dfs(int x,int y)
{
	vis[x][y]=1,cnt++;
	for(int i=0;i<8;i++)
		if(chk(x+f1[i],y+f2[i]))
			col[x+f1[i]][y+f2[i]]=!col[x][y],dfs(x+f1[i],y+f2[i]);
}
int main()
{
	scanf("%d%d%d%d",&n,&m,&r,&c);
	f1={-r,-c,c,r,r,c,-c,-r},f2={c,r,r,c,-c,-r,-r,-c};
	for(int i=1;i<=n;i++)
	{
		scanf("%s",str);
		for(int j=1;j<=m;j++)
			if(str[j-1]=='A') x1=i,y1=j;
			else if(str[j-1]=='B') x2=i,y2=j;
			else if(str[j-1]=='@') p[i][j]=1;
	}
	dfs(x1,y1);
	printf("%s",cnt>1&&(!vis[x2][y2]||col[x2][y2]==0)?"Alice":"Bob");
}

Details

Test #1:

score: 100
Accepted
time: 1ms
memory: 3692kb

Test #2:

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

Test #3:

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

Test #4:

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

Test #5:

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

Test #6:

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

Test #7:

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

Test #8:

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

Test #9:

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

Test #10:

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

Test #11:

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

Test #12:

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

Test #13:

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

Test #14:

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

Test #15:

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

Test #16:

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

Test #17:

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

Test #18:

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

Test #19:

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

Test #20:

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

Test #21:

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

Test #22:

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

Test #23:

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

Test #24:

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

Test #25:

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

Test #26:

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

Test #27:

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

Test #28:

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

Test #29:

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

Test #30:

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

Test #31:

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

Test #32:

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

Test #33:

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

Test #34:

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

Test #35:

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

Test #36:

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

Test #37:

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

Test #38:

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

Test #39:

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

Test #40:

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

Test #41:

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

Test #42:

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

Test #43:

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

Test #44:

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

Test #45:

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

Test #46:

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

Test #47:

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

Test #48:

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

Test #49:

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

Test #50:

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

Test #51:

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

Test #52:

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

Test #53:

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

Test #54:

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

Test #55:

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

Test #56:

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

Test #57:

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

Test #58:

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

Test #59:

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

Test #60:

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

Test #61:

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

Test #62:

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

Test #63:

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

Test #64:

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

Test #65:

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

Test #66:

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

Test #67:

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

Test #68:

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

Test #69:

score: 0
Accepted
time: 71ms
memory: 53388kb

Test #70:

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

Test #71:

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

Test #72:

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

Test #73:

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

Test #74:

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

Test #75:

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

Test #76:

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

Test #77:

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

Test #78:

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

Test #79:

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

Test #80:

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

Test #81:

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

Test #82:

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

Test #83:

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

Test #84:

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

Test #85:

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

Test #86:

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

Test #87:

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

Test #88:

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

Test #89:

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

Test #90:

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

Test #91:

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

Test #92:

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

Test #93:

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

Test #94:

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

Test #95:

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

Test #96:

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

Test #97:

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

Test #98:

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

Test #99:

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

Test #100:

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

Test #101:

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

Test #102:

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

Test #103:

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

Test #104:

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

Test #105:

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

Test #106:

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

Test #107:

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

Test #108:

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

Test #109:

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

Test #110:

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

Test #111:

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

Test #112:

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

Test #113:

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

Test #114:

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

Test #115:

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

Test #116:

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

Test #117:

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

Test #118:

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

Test #119:

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

Test #120:

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

Test #121:

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

Test #122:

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

Test #123:

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

Test #124:

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

Test #125:

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

Test #126:

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

Test #127:

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

Test #128:

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

Test #129:

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

Test #130:

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

Test #131:

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

Test #132:

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

Test #133:

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

Test #134:

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

Test #135:

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

Test #136:

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

Test #137:

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

Test #138:

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

Test #139:

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

Test #140:

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

Test #141:

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

Test #142:

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

Test #143:

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

Test #144:

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

Test #145:

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

Test #146:

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

Test #147:

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

Test #148:

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

Test #149:

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

Test #150:

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

Test #151:

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

Test #152:

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

Test #153:

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

Test #154:

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

Test #155:

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

Test #156:

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

Test #157:

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

Test #158:

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

Test #159:

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

Test #160:

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

Test #161:

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

Test #162:

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

Test #163:

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

Test #164:

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

Test #165:

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

Test #166:

score: 0
Accepted
time: 71ms
memory: 34740kb