結果
問題 | No.2412 YOU Grow Bigger! |
ユーザー | mymelochan |
提出日時 | 2023-08-11 22:29:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 236 ms / 6,000 ms |
コード長 | 1,706 bytes |
コンパイル時間 | 154 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 77,500 KB |
最終ジャッジ日時 | 2024-11-21 08:44:03 |
合計ジャッジ時間 | 4,155 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
55,572 KB |
testcase_01 | AC | 43 ms
55,448 KB |
testcase_02 | AC | 47 ms
62,488 KB |
testcase_03 | AC | 179 ms
77,280 KB |
testcase_04 | AC | 185 ms
77,252 KB |
testcase_05 | AC | 198 ms
77,276 KB |
testcase_06 | AC | 177 ms
77,392 KB |
testcase_07 | AC | 181 ms
77,312 KB |
testcase_08 | AC | 193 ms
77,500 KB |
testcase_09 | AC | 56 ms
66,472 KB |
testcase_10 | AC | 72 ms
76,628 KB |
testcase_11 | AC | 52 ms
64,136 KB |
testcase_12 | AC | 43 ms
55,180 KB |
testcase_13 | AC | 83 ms
76,544 KB |
testcase_14 | AC | 63 ms
70,028 KB |
testcase_15 | AC | 46 ms
56,568 KB |
testcase_16 | AC | 54 ms
66,424 KB |
testcase_17 | AC | 63 ms
70,508 KB |
testcase_18 | AC | 131 ms
76,736 KB |
testcase_19 | AC | 43 ms
54,992 KB |
testcase_20 | AC | 55 ms
65,740 KB |
testcase_21 | AC | 82 ms
76,540 KB |
testcase_22 | AC | 81 ms
76,584 KB |
testcase_23 | AC | 235 ms
77,448 KB |
testcase_24 | AC | 236 ms
77,480 KB |
testcase_25 | AC | 119 ms
76,996 KB |
testcase_26 | AC | 71 ms
76,760 KB |
testcase_27 | AC | 65 ms
71,900 KB |
testcase_28 | AC | 88 ms
76,812 KB |
testcase_29 | AC | 43 ms
55,328 KB |
testcase_30 | AC | 46 ms
61,968 KB |
ソースコード
############################################################# import sys sys.setrecursionlimit(10**7) from heapq import heappop,heappush from collections import deque,defaultdict,Counter from bisect import bisect_left, bisect_right from itertools import product,combinations,permutations from math import sin,cos #from math import isqrt #DO NOT USE PyPy ipt = sys.stdin.readline iin = lambda :int(ipt()) lmin = lambda :list(map(int,ipt().split())) ############################################################# H,W = lmin() T = [list(input()) for _ in range(H)] st = [(1,1)] d = [] for i in range(-1,2): for j in range(-1,2): if i|j == 0: continue d.append((i,j)) def func(S): st = [(1,1)] visited = [[0]*W for _ in range(H)] while st: i,j = st.pop() if i == H-2 and j == W-2: return True for di,dj in d: ni = di+i nj = dj+j if 1<=ni<H-1 and 1<=nj<W-1: if visited[ni][nj]: continue visited[ni][nj] = 1 g = 0 for ii in range(-1,2): for jj in range(-1,2): if S[ni+ii][nj+jj] == "#": g = 1 if g == 0: st.append((ni,nj)) return False if not func(T): print(0) exit() for i in range(H): for j in range(W): if i <= 2 and j <= 2: continue if i >= H-3 and j >= W-3: continue if T[i][j] == ".": T[i][j] = "#" if not func(T): print(1) exit() T[i][j] = "." print(2)