結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | aaaaaaaaaa2230 |
提出日時 | 2022-09-02 22:11:29 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 580 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 848,168 KB |
最終ジャッジ日時 | 2024-04-27 21:45:46 |
合計ジャッジ時間 | 5,628 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
51,872 KB |
testcase_01 | AC | 38 ms
52,868 KB |
testcase_02 | AC | 38 ms
52,940 KB |
testcase_03 | AC | 38 ms
53,080 KB |
testcase_04 | AC | 38 ms
52,456 KB |
testcase_05 | AC | 38 ms
53,616 KB |
testcase_06 | AC | 38 ms
53,196 KB |
testcase_07 | AC | 38 ms
52,696 KB |
testcase_08 | AC | 45 ms
60,472 KB |
testcase_09 | AC | 43 ms
58,936 KB |
testcase_10 | AC | 48 ms
60,896 KB |
testcase_11 | MLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
h,w = map(int,input().split()) S = [input() for i in range(h)] ans = [] ans.append(S[0][0]) l = [[0,0]] for i in range(h+w-1): cands = [[] for j in range(26)] for x,y in l: nx,ny = x+1,y if 0 <= nx < h and 0 <= ny < w: cands[ord(S[nx][ny])-ord("a")].append([nx,ny]) nx,ny = x,y+1 if 0 <= nx < h and 0 <= ny < w: cands[ord(S[nx][ny])-ord("a")].append([nx,ny]) for j in range(26): if cands[j] != []: l = cands[j] ans.append(chr(j+ord("a"))) break print(*ans,sep="")