結果

問題 No.205 マージして辞書順最小
ユーザー ああいい
提出日時 2022-02-23 23:11:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 244 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 76,600 KB
最終ジャッジ日時 2024-07-01 23:34:10
合計ジャッジ時間 2,185 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 7 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
import heapq
q = []
for _ in range(N):
    S = input()
    q.append(S+"+")
heapq.heapify(q)
ans = []
while q:
    S = heapq.heappop(q)
    ans.append(S[0])
    if len(S) != 2:
        heapq.heappush(q,S[1:])
print("".join(ans))
0