結果
| 問題 | No.2064 Smallest Sequence on Grid |
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2022-09-02 22:00:06 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,063 ms / 3,000 ms |
| + 993µs | |
| コード長 | 488 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 82,708 KB |
| 実行使用メモリ | 112,404 KB |
| 最終ジャッジ日時 | 2026-09-24 01:22:35 |
| 合計ジャッジ時間 | 12,935 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
h, w = map(int, input().split())
s = [input() for _ in range(h)]
ans = [s[0][0]]
tij = {(0, 0)}
m = s[0][0]
for _ in range(h+w-2):
tij_new = set()
m_new = "z"
for i, j in tij:
if s[i][j] == m and i < h-1:
tij_new.add((i+1, j))
m_new = min(m_new, s[i+1][j])
if s[i][j] == m and j < w-1:
tij_new.add((i, j+1))
m_new = min(m_new, s[i][j+1])
tij = set(tij_new)
m = m_new
ans.append(m)
print("".join(ans))
ニックネーム