結果
問題 |
No.2064 Smallest Sequence on Grid
|
ユーザー |
|
提出日時 | 2025-04-19 13:52:47 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 899 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 82,684 KB |
実行使用メモリ | 144,736 KB |
最終ジャッジ日時 | 2025-04-19 13:53:10 |
合計ジャッジ時間 | 23,356 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 TLE * 2 |
ソースコード
## https://yukicoder.me/problems/no/2064 def main(): H, W= map(int ,input().split()) S = [] for _ in range(H): S.append(input()) current = [(0, 0)] answer = [S[0][0]] for _ in range(H + W - 2): max_word = "zzzz" max_list = [] for ci, cj in current: for di, dj in ((1, 0), (0, 1)): next_ci = ci + di next_cj = cj + dj if 0 <= next_ci < H and 0 <= next_cj < W: s = S[next_ci][next_cj] if max_word == s: max_list.append((next_ci, next_cj)) elif max_word > s: max_word = s max_list = [(next_ci, next_cj)] answer.append(max_word) current = list(set(max_list)) print("".join(answer)) if __name__ == "__main__": main()