AtCoder Typical Contest 001

Submission #420842

Source codeソースコード

def search(route, x, y):
	if ((x < 0) | (w <= x) | (y < 0) | (h <= y)):
		return

	nextPoint = c[y][x]
	if nextPoint == "g":
		print "Yes"
		exit()
	elif ((nextPoint == ".") | (nextPoint == "s")):
		route += 1
		if(route < step[y][x]):
			step[y][x] = route
			search(route, x - 1, y)
			search(route, x + 1, y)
			search(route, x, y - 1)
			search(route, x, y + 1)
	return

global h
global w
global c
global step

h, w = map(int, raw_input().split())
c = []
step = [[30000 for _ in xrange(0,w)] for __ in range(0,h)]
for i in xrange(0, h):
	c.append(list(raw_input()))

for i, math in enumerate(c):
	if("s" in math):
		search(-1, math.index("s"), i)

print "No"

Submission

Task問題 A - 深さ優先探索
User nameユーザ名 Mint
Created time投稿日時
Language言語 Python (2.7.3)
Status状態 RE
Score得点 0
Source lengthソースコード長 695 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,00_sample_05.txt
All 0 / 100 00_min_01.txt,00_min_02.txt,00_min_03.txt,00_min_04.txt,00_min_05.txt,00_min_06.txt,00_min_07.txt,00_min_08.txt,00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,00_sample_05.txt,01_rnd_00.txt,01_rnd_01.txt,01_rnd_02.txt,01_rnd_03.txt,01_rnd_04.txt,01_rnd_05.txt,01_rnd_06.txt,01_rnd_07.txt,01_rnd_08.txt,01_rnd_09.txt,01_rnd_10.txt,01_rnd_11.txt,01_rnd_12.txt,01_rnd_13.txt,01_rnd_14.txt,01_rnd_15.txt,01_rnd_16.txt,01_rnd_17.txt,01_rnd_18.txt,01_rnd_19.txt,02_rndhard_00.txt,02_rndhard_01.txt,02_rndhard_02.txt,02_rndhard_03.txt,02_rndhard_04.txt,02_rndhard_05.txt,02_rndhard_06.txt,02_rndhard_07.txt,02_rndhard_08.txt,02_rndhard_09.txt,02_rndhard_10.txt,02_rndhard_11.txt,02_rndhard_12.txt,02_rndhard_13.txt,02_rndhard_14.txt,02_rndhard_15.txt,02_rndhard_16.txt,02_rndhard_17.txt,02_rndhard_18.txt,02_rndhard_19.txt,02_rndhard_20.txt,02_rndhard_21.txt,02_rndhard_22.txt,02_rndhard_23.txt,02_rndhard_24.txt,02_rndhard_25.txt,02_rndhard_26.txt,02_rndhard_27.txt,02_rndhard_28.txt,02_rndhard_29.txt,02_rndhard_30.txt,02_rndhard_31.txt,02_rndhard_32.txt,02_rndhard_33.txt,02_rndhard_34.txt,02_rndhard_35.txt,02_rndhard_36.txt,02_rndhard_37.txt,02_rndhard_38.txt,02_rndhard_39.txt,03_rndhardsmall_00.txt,03_rndhardsmall_01.txt,03_rndhardsmall_02.txt,03_rndhardsmall_03.txt,03_rndhardsmall_04.txt,03_rndhardsmall_05.txt,03_rndhardsmall_06.txt,03_rndhardsmall_07.txt,03_rndhardsmall_08.txt,03_rndhardsmall_09.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_min_01.txt AC 70 ms 3284 KB
00_min_02.txt AC 56 ms 3500 KB
00_min_03.txt AC 56 ms 3504 KB
00_min_04.txt AC 56 ms 3504 KB
00_min_05.txt AC 55 ms 3492 KB
00_min_06.txt AC 56 ms 3504 KB
00_min_07.txt AC 58 ms 3504 KB
00_min_08.txt AC 57 ms 3500 KB
00_sample_01.txt AC 56 ms 3304 KB
00_sample_02.txt AC 56 ms 3500 KB
00_sample_03.txt AC 56 ms 3504 KB
00_sample_04.txt AC 56 ms 3500 KB
00_sample_05.txt AC 56 ms 3500 KB
01_rnd_00.txt AC 102 ms 7724 KB
01_rnd_01.txt RE
01_rnd_02.txt RE
01_rnd_03.txt RE
01_rnd_04.txt RE
01_rnd_05.txt AC 106 ms 7728 KB
01_rnd_06.txt RE
01_rnd_07.txt RE
01_rnd_08.txt AC 105 ms 7716 KB
01_rnd_09.txt AC 107 ms 7668 KB
01_rnd_10.txt RE
01_rnd_11.txt AC 105 ms 7656 KB
01_rnd_12.txt RE
01_rnd_13.txt RE
01_rnd_14.txt AC 104 ms 7660 KB
01_rnd_15.txt RE
01_rnd_16.txt AC 104 ms 7720 KB
01_rnd_17.txt RE
01_rnd_18.txt AC 106 ms 7716 KB
01_rnd_19.txt RE
02_rndhard_00.txt AC 165 ms 7848 KB
02_rndhard_01.txt AC 165 ms 7844 KB
02_rndhard_02.txt RE
02_rndhard_03.txt RE
02_rndhard_04.txt AC 107 ms 7652 KB
02_rndhard_05.txt AC 110 ms 7656 KB
02_rndhard_06.txt AC 170 ms 7832 KB
02_rndhard_07.txt AC 107 ms 7716 KB
02_rndhard_08.txt AC 1058 ms 8108 KB
02_rndhard_09.txt AC 1045 ms 8100 KB
02_rndhard_10.txt AC 1249 ms 8040 KB
02_rndhard_11.txt AC 1257 ms 8040 KB
02_rndhard_12.txt AC 665 ms 7912 KB
02_rndhard_13.txt AC 668 ms 7912 KB
02_rndhard_14.txt AC 1284 ms 8100 KB
02_rndhard_15.txt AC 1283 ms 8040 KB
02_rndhard_16.txt AC 129 ms 7732 KB
02_rndhard_17.txt AC 129 ms 7724 KB
02_rndhard_18.txt AC 161 ms 7844 KB
02_rndhard_19.txt AC 154 ms 7652 KB
02_rndhard_20.txt AC 195 ms 7856 KB
02_rndhard_21.txt AC 196 ms 7856 KB
02_rndhard_22.txt AC 1659 ms 8236 KB
02_rndhard_23.txt AC 879 ms 8108 KB
02_rndhard_24.txt AC 135 ms 7848 KB
02_rndhard_25.txt AC 136 ms 7852 KB
02_rndhard_26.txt AC 159 ms 7856 KB
02_rndhard_27.txt AC 107 ms 7724 KB
02_rndhard_28.txt AC 208 ms 7852 KB
02_rndhard_29.txt AC 215 ms 7788 KB
02_rndhard_30.txt AC 104 ms 7716 KB
02_rndhard_31.txt AC 104 ms 7728 KB
02_rndhard_32.txt AC 858 ms 7980 KB
02_rndhard_33.txt AC 758 ms 7972 KB
02_rndhard_34.txt AC 133 ms 7844 KB
02_rndhard_35.txt AC 133 ms 7656 KB
02_rndhard_36.txt AC 125 ms 7656 KB
02_rndhard_37.txt AC 124 ms 7844 KB
02_rndhard_38.txt AC 218 ms 7852 KB
02_rndhard_39.txt AC 219 ms 7844 KB
03_rndhardsmall_00.txt AC 57 ms 3500 KB
03_rndhardsmall_01.txt AC 56 ms 3496 KB
03_rndhardsmall_02.txt AC 56 ms 3492 KB
03_rndhardsmall_03.txt AC 57 ms 3496 KB
03_rndhardsmall_04.txt AC 56 ms 3304 KB
03_rndhardsmall_05.txt AC 56 ms 3304 KB
03_rndhardsmall_06.txt AC 56 ms 3304 KB
03_rndhardsmall_07.txt AC 57 ms 3492 KB
03_rndhardsmall_08.txt AC 56 ms 3492 KB
03_rndhardsmall_09.txt AC 57 ms 3496 KB