結果

問題 No.205 マージして辞書順最小
ユーザー 👑 rin204
提出日時 2022-07-06 08:02:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 232 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 82,080 KB
実行使用メモリ 76,624 KB
最終ジャッジ日時 2024-12-20 02:16:14
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

n = int(input())
hq = [input() + chr(130) for _ in range(n)]
heapify(hq)
ans = []
while hq:
    S = heappop(hq)
    ans.append(S[0])
    S = S[1:]
    if len(S) >= 2:
        heappush(hq, S)
print(*ans, sep="")
0