結果

問題 No.205 マージして辞書順最小
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-24 14:35:01
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 231 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 77,748 KB
実行使用メモリ 80,820 KB
最終ジャッジ日時 2023-09-20 11:14:23
合計ジャッジ時間 3,386 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
77,756 KB
testcase_01 AC 77 ms
77,880 KB
testcase_02 AC 97 ms
79,492 KB
testcase_03 AC 101 ms
79,320 KB
testcase_04 AC 99 ms
79,236 KB
testcase_05 AC 101 ms
79,492 KB
testcase_06 AC 77 ms
78,284 KB
testcase_07 AC 122 ms
80,456 KB
testcase_08 AC 115 ms
80,392 KB
testcase_09 AC 113 ms
80,320 KB
testcase_10 AC 106 ms
79,828 KB
testcase_11 AC 111 ms
79,876 KB
testcase_12 AC 125 ms
80,820 KB
testcase_13 AC 123 ms
80,512 KB
testcase_14 AC 77 ms
77,952 KB
testcase_15 AC 78 ms
77,888 KB
testcase_16 AC 79 ms
78,204 KB
testcase_17 AC 80 ms
78,096 KB
testcase_18 AC 76 ms
78,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
N=int(raw_input())
hp=[]
for i in range(N):
    S=raw_input()
    heappush(hp,S+"{")
ans=""
while len(hp)!=0:
    s=heappop(hp)
    ans+=s[0]
    if len(s)>2:
        heappush(hp,s[1:])
print ans
0