結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | umyomyomyon |
提出日時 | 2022-09-20 20:08:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 709 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 87,156 KB |
実行使用メモリ | 86,764 KB |
最終ジャッジ日時 | 2023-08-23 19:38:37 |
合計ジャッジ時間 | 6,065 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,240 KB |
testcase_01 | AC | 72 ms
71,216 KB |
testcase_02 | AC | 71 ms
71,376 KB |
testcase_03 | AC | 72 ms
71,288 KB |
testcase_04 | AC | 73 ms
71,220 KB |
testcase_05 | AC | 71 ms
71,164 KB |
testcase_06 | WA | - |
testcase_07 | AC | 73 ms
71,348 KB |
testcase_08 | AC | 71 ms
71,236 KB |
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 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 149 ms
86,136 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 139 ms
85,424 KB |
testcase_30 | WA | - |
ソースコード
H, W = list(map(int, input().split())) S = [input() for _ in range(H)] T = '' def pick_right(h, w): if w == W - 1: return None return S[h][w + 1] def pick_below(h, w): if h == H - 1: return None return S[h + 1][w] def move(h, w): right = pick_right(h, w) below = pick_below(h, w) if right is None and below is None: return None if right is None: return (h + 1, w) if below is None: return (h, w + 1) if right > below: return (h + 1, w) if right < below: return (h , w + 1) if right == below: return (h + 1, w) flag = True h, w = 0, 0 while(flag): T += S[h][w] p = move(h, w) if p is None: flag = False break h, w = p[0], p[1] print(T)