結果

問題 No.205 マージして辞書順最小
ユーザー yaoshimax
提出日時 2015-05-24 14:35:01
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 231 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 76,688 KB
実行使用メモリ 78,992 KB
最終ジャッジ日時 2024-07-06 06:41:01
合計ジャッジ時間 2,860 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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