結果

問題 No.2412 YOU Grow Bigger!
ユーザー ニックネームニックネーム
提出日時 2023-08-11 22:58:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 792 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 105,812 KB
最終ジャッジ日時 2024-04-29 14:08:11
合計ジャッジ時間 14,792 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,968 KB
testcase_01 AC 44 ms
51,712 KB
testcase_02 AC 56 ms
61,696 KB
testcase_03 AC 1,899 ms
105,344 KB
testcase_04 AC 1,884 ms
101,760 KB
testcase_05 AC 1,249 ms
96,384 KB
testcase_06 AC 1,494 ms
97,024 KB
testcase_07 AC 1,965 ms
105,812 KB
testcase_08 AC 1,565 ms
100,992 KB
testcase_09 AC 63 ms
63,872 KB
testcase_10 AC 177 ms
76,852 KB
testcase_11 AC 55 ms
61,440 KB
testcase_12 AC 43 ms
51,968 KB
testcase_13 AC 197 ms
76,928 KB
testcase_14 AC 72 ms
66,944 KB
testcase_15 AC 44 ms
52,480 KB
testcase_16 AC 58 ms
62,208 KB
testcase_17 AC 68 ms
66,560 KB
testcase_18 AC 324 ms
78,128 KB
testcase_19 AC 43 ms
52,096 KB
testcase_20 AC 62 ms
63,488 KB
testcase_21 WA -
testcase_22 AC 184 ms
77,056 KB
testcase_23 AC 342 ms
78,256 KB
testcase_24 AC 803 ms
84,864 KB
testcase_25 WA -
testcase_26 AC 149 ms
76,428 KB
testcase_27 AC 113 ms
75,904 KB
testcase_28 AC 253 ms
77,500 KB
testcase_29 AC 43 ms
52,608 KB
testcase_30 AC 53 ms
59,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
s = [input()+"#" for _ in range(h)]+["#"*(w+1)]
def check(t):
    f = [[False]*(w+1) for _ in range(h+1)]
    f[1][1] = True; st = [(1,1)]
    while st:
        px,py = st.pop()
        for dx,dy in ((-1,0),(0,-1),(0,1),(1,0)):
            nx,ny = px+dx,py+dy
            if f[nx][ny]: continue
            g = True
            for i in range(-1,2):
                for j in range(-1,2):
                    g &= t[nx+i][ny+j]=="."
            if g: f[nx][ny] = True; st.append((nx,ny))
    return f[h-2][w-2]
if not check(s): exit(print(0))
for i in range(h):
    for j in range(w):
        if 0<=i<=2 and 0<=j<=2 or h-3<=i<=h-1 and w-3<=j<=w-1: continue
        t = [list(si) for si in s]
        t[i][j] = "#"
        if not check(t): exit(print(1))
print(2)
0