結果

問題 No.205 マージして辞書順最小
ユーザー convexineqconvexineq
提出日時 2020-12-18 19:47:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 5,000 ms
コード長 243 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,668 KB
実行使用メモリ 73,168 KB
最終ジャッジ日時 2023-10-21 08:14:13
合計ジャッジ時間 2,664 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,404 KB
testcase_01 AC 37 ms
53,404 KB
testcase_02 AC 49 ms
63,728 KB
testcase_03 AC 49 ms
63,736 KB
testcase_04 AC 52 ms
65,872 KB
testcase_05 AC 53 ms
63,748 KB
testcase_06 AC 36 ms
53,404 KB
testcase_07 AC 55 ms
70,572 KB
testcase_08 AC 63 ms
70,576 KB
testcase_09 AC 56 ms
70,572 KB
testcase_10 AC 58 ms
70,532 KB
testcase_11 AC 64 ms
73,140 KB
testcase_12 AC 67 ms
73,168 KB
testcase_13 AC 53 ms
68,512 KB
testcase_14 AC 36 ms
53,404 KB
testcase_15 AC 35 ms
53,404 KB
testcase_16 AC 36 ms
53,404 KB
testcase_17 AC 34 ms
53,404 KB
testcase_18 AC 34 ms
53,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
r = 0
from heapq import *
q = []
for _ in range(n):
    s = input()+"{"
    q.append(s)
    r += len(s)-1
heapify(q)
ans = []
for i in range(r):
    s = heappop(q)
    ans.append(s[0])
    heappush(q,s[1:])
print("".join(ans))
0