結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | first_vil |
提出日時 | 2022-09-02 21:44:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 82,224 KB |
実行使用メモリ | 329,008 KB |
最終ジャッジ日時 | 2024-04-27 21:14:46 |
合計ジャッジ時間 | 26,357 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,400 KB |
testcase_01 | AC | 38 ms
53,124 KB |
testcase_02 | AC | 39 ms
52,768 KB |
testcase_03 | AC | 40 ms
54,264 KB |
testcase_04 | AC | 40 ms
52,396 KB |
testcase_05 | AC | 37 ms
53,012 KB |
testcase_06 | AC | 37 ms
53,476 KB |
testcase_07 | AC | 38 ms
52,788 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 1,951 ms
328,288 KB |
testcase_21 | AC | 1,963 ms
328,412 KB |
testcase_22 | AC | 1,969 ms
328,160 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 1,945 ms
328,152 KB |
testcase_27 | WA | - |
testcase_28 | AC | 1,136 ms
328,356 KB |
testcase_29 | AC | 1,510 ms
309,764 KB |
testcase_30 | WA | - |
ソースコード
from math import gcd import sys int1 = lambda x: int(x) - 1 # input = lambda: sys.stdin.buffer.readline() input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) i1 = lambda: int1(input()) mi = lambda: map(int, input().split()) mi1 = lambda: map(int1, input().split()) li = lambda: list(mi()) li1 = lambda: list(mi1()) lli = lambda n: [li() for _ in range(n)] INF = float("inf") mod = int(1e9 + 7) # mod = 998244353 h, w = mi() s = [input() for i in range(h)] ans = [s[0][0]] e = chr(ord("z") + 1) d = [list() for i in range(h + w - 1)] for y in range(h): for x in range(w): d[y + x].append(y * w + x) f = [[False] * w for i in range(h)] f[0][0] = True for i in range(h + w - 2): mn = e for tmp in d[i]: y, x = tmp // w, tmp % w if not f[y][x]: continue if y + 1 < h and mn > s[y + 1][x]: mn = s[y + 1][x] if x + 1 < w and mn > s[y][x + 1]: mn = s[y][x + 1] ans.append(mn) for tmp in d[i + 1]: y, x = tmp // w, tmp % w if s[y][x] == mn: f[y][x] = True print("".join(ans))