結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | とりゐ |
提出日時 | 2022-08-27 11:37:19 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 847,920 KB |
最終ジャッジ日時 | 2024-04-27 20:15:54 |
合計ジャッジ時間 | 6,249 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
54,796 KB |
testcase_01 | AC | 35 ms
54,212 KB |
testcase_02 | AC | 35 ms
55,076 KB |
testcase_03 | AC | 33 ms
54,172 KB |
testcase_04 | AC | 35 ms
54,008 KB |
testcase_05 | AC | 34 ms
54,300 KB |
testcase_06 | AC | 34 ms
53,600 KB |
testcase_07 | AC | 35 ms
54,416 KB |
testcase_08 | AC | 37 ms
54,884 KB |
testcase_09 | AC | 36 ms
55,208 KB |
testcase_10 | AC | 36 ms
56,448 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 | -- | - |
ソースコード
from collections import defaultdict def f(x): return ord(x)-97 h,w=map(int,input().split()) s=[] for i in range(h): s.append(input()) a=[[0]*w for i in range(h)] a[0][0]=1 dxdy=[(0,1),(1,0)] ans=[] todo=[(0,0)] for i in range(h+w-1): d=[] mn='z' for x,y in todo: if mn==s[x][y]: d.append((x,y)) elif mn>s[x][y]: d=[(x,y)] mn=s[x][y] ans.append(mn) todo=[] for x,y in d: for dx,dy in dxdy: if 0<=x+dx<h and 0<=y+dy<w: a[x+dx][y+dy]=1 todo.append((x+dx,y+dy)) print(*ans,sep='')