結果

問題 No.205 マージして辞書順最小
ユーザー ntuda
提出日時 2025-01-24 23:58:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 220 bytes
コンパイル時間 1,320 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 76,156 KB
最終ジャッジ日時 2025-01-24 23:58:06
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *
N = int(input())
S = [list(input())+["{"] for _ in range(N)]

heapify(S)
ans = []
while S:
    x = heappop(S)
    if len(x) > 1:
        ans.append(x[0])
        heappush(S,x[1:])
print("".join(ans))
0