結果

問題 No.205 マージして辞書順最小
ユーザー 👑 rin204rin204
提出日時 2022-07-06 08:02:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 232 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 77,912 KB
最終ジャッジ日時 2023-08-23 01:33:08
合計ジャッジ時間 3,617 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,376 KB
testcase_01 AC 76 ms
71,140 KB
testcase_02 AC 103 ms
76,128 KB
testcase_03 AC 100 ms
75,972 KB
testcase_04 AC 96 ms
76,048 KB
testcase_05 AC 97 ms
75,916 KB
testcase_06 AC 77 ms
71,220 KB
testcase_07 AC 117 ms
77,912 KB
testcase_08 AC 120 ms
77,828 KB
testcase_09 AC 117 ms
77,848 KB
testcase_10 AC 109 ms
77,580 KB
testcase_11 AC 112 ms
77,452 KB
testcase_12 AC 122 ms
77,656 KB
testcase_13 AC 120 ms
77,620 KB
testcase_14 AC 77 ms
71,308 KB
testcase_15 AC 75 ms
71,104 KB
testcase_16 AC 81 ms
71,264 KB
testcase_17 AC 77 ms
71,100 KB
testcase_18 AC 76 ms
71,268 KB
権限があれば一括ダウンロードができます

ソースコード

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