結果

問題 No.205 マージして辞書順最小
ユーザー roiti46roiti46
提出日時 2015-05-09 01:15:02
言語 Python2
(2.7.18)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 248 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 6,520 KB
実行使用メモリ 6,228 KB
最終ジャッジ日時 2023-09-19 09:12:37
合計ジャッジ時間 1,312 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,216 KB
testcase_01 AC 12 ms
6,168 KB
testcase_02 AC 14 ms
6,092 KB
testcase_03 AC 14 ms
6,124 KB
testcase_04 AC 14 ms
6,228 KB
testcase_05 AC 14 ms
6,084 KB
testcase_06 AC 12 ms
6,176 KB
testcase_07 AC 15 ms
6,228 KB
testcase_08 AC 15 ms
6,224 KB
testcase_09 AC 16 ms
6,160 KB
testcase_10 AC 15 ms
6,096 KB
testcase_11 AC 15 ms
6,092 KB
testcase_12 AC 16 ms
6,092 KB
testcase_13 AC 15 ms
6,092 KB
testcase_14 AC 12 ms
6,168 KB
testcase_15 AC 12 ms
6,084 KB
testcase_16 AC 13 ms
6,176 KB
testcase_17 AC 13 ms
6,188 KB
testcase_18 AC 12 ms
6,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N = int(raw_input())
S = [raw_input() + "{" for i in xrange(N)]
M = sum(map(len, S)) - N
heapq.heapify(S)
T = ""

for i in xrange(M):
    s = heapq.heappop(S)
    if s == "": continue
    T += s[0]
    heapq.heappush(S, s[1:])
print T
0