結果

問題 No.2064 Smallest Sequence on Grid
ユーザー flygonflygon
提出日時 2022-09-18 22:39:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 362 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 307,488 KB
最終ジャッジ日時 2023-08-23 18:22:57
合計ジャッジ時間 9,243 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,680 KB
testcase_01 AC 74 ms
70,904 KB
testcase_02 AC 72 ms
70,868 KB
testcase_03 AC 72 ms
70,968 KB
testcase_04 AC 72 ms
70,932 KB
testcase_05 AC 74 ms
70,788 KB
testcase_06 AC 74 ms
70,852 KB
testcase_07 AC 72 ms
70,724 KB
testcase_08 AC 80 ms
75,764 KB
testcase_09 AC 77 ms
75,748 KB
testcase_10 AC 82 ms
75,604 KB
testcase_11 AC 82 ms
75,796 KB
testcase_12 AC 83 ms
75,560 KB
testcase_13 AC 84 ms
75,608 KB
testcase_14 AC 84 ms
75,588 KB
testcase_15 AC 84 ms
75,652 KB
testcase_16 AC 84 ms
75,560 KB
testcase_17 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w = map(int,input().split())
s = [input() for i in range(h)]
dp = [""]*(w)
for i in range(h):
  new = [""]*w
  for j in range(w):
    if i == 0 and j == 0:
      new[j] = s[0][0]
    elif i == 0:
      new[j] = new[j-1] + s[i][j]
    elif j == 0:
      new[j] = dp[j] + s[i][j]
    else:
      new[j] = min(new[j-1], dp[j]) + s[i][j]
  dp = new
print(new[-1])
0