結果

問題 No.205 マージして辞書順最小
ユーザー tktk_snsntktk_snsn
提出日時 2021-02-11 23:48:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 223 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 77,300 KB
最終ジャッジ日時 2023-09-25 13:37:20
合計ジャッジ時間 3,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,664 KB
testcase_01 AC 74 ms
71,028 KB
testcase_02 AC 94 ms
75,800 KB
testcase_03 AC 93 ms
75,456 KB
testcase_04 AC 91 ms
75,420 KB
testcase_05 AC 93 ms
75,696 KB
testcase_06 AC 73 ms
71,188 KB
testcase_07 AC 110 ms
77,168 KB
testcase_08 AC 109 ms
77,300 KB
testcase_09 AC 109 ms
77,120 KB
testcase_10 AC 99 ms
76,608 KB
testcase_11 AC 103 ms
77,208 KB
testcase_12 AC 112 ms
77,176 KB
testcase_13 AC 114 ms
77,136 KB
testcase_14 AC 73 ms
71,148 KB
testcase_15 AC 78 ms
71,000 KB
testcase_16 AC 74 ms
70,708 KB
testcase_17 AC 74 ms
70,808 KB
testcase_18 AC 75 ms
70,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N = int(input())
S = [input() + "{" for _ in range(N)]
heapq.heapify(S)

ans = []
while S:
    X = heapq.heappop(S)
    ans.append(X[0])
    if len(X) > 2:
        heapq.heappush(S, X[1:])

print("".join(ans))
0