結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | vwxyz |
提出日時 | 2023-01-14 23:27:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 87,004 KB |
実行使用メモリ | 87,644 KB |
最終ジャッジ日時 | 2023-08-27 04:06:58 |
合計ジャッジ時間 | 10,315 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
71,128 KB |
testcase_01 | AC | 82 ms
71,396 KB |
testcase_02 | AC | 82 ms
71,304 KB |
testcase_03 | AC | 83 ms
70,920 KB |
testcase_04 | AC | 83 ms
71,276 KB |
testcase_05 | AC | 84 ms
71,180 KB |
testcase_06 | WA | - |
testcase_07 | AC | 85 ms
71,348 KB |
testcase_08 | AC | 84 ms
71,140 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 | 148 ms
86,956 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 153 ms
85,356 KB |
testcase_30 | WA | - |
ソースコード
import sys readline=sys.stdin.readline H,W=map(int,readline().split()) S=[readline().rstrip() for h in range(H)] ans_lst=[S[0][0]] queue=[(0,0)] for _ in range(H+W-2): s=min([S[h+1][w] for h,w in queue if h+1<H]+[S[h][w+1] for h,w in queue if w+1<W]) ans_lst.append(s) prev=queue queue=[] for h,w in prev: if h+1<H and S[h+1][w]==s: queue.append((h+1,w)) if w+1<W and S[h][w+1]==s: if queue and (h,w+1)!=queue[-1]: continue queue.append((h,w+1)) print(*ans_lst,sep="")