結果

問題 No.205 マージして辞書順最小
ユーザー qibqib
提出日時 2023-02-16 16:56:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 293 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 78,188 KB
最終ジャッジ日時 2023-09-25 21:24:17
合計ジャッジ時間 3,995 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,364 KB
testcase_01 AC 76 ms
71,392 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 79 ms
71,212 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 103 ms
76,580 KB
testcase_11 AC 125 ms
77,440 KB
testcase_12 WA -
testcase_13 AC 122 ms
78,188 KB
testcase_14 AC 78 ms
71,556 KB
testcase_15 AC 76 ms
71,204 KB
testcase_16 AC 77 ms
71,312 KB
testcase_17 AC 76 ms
71,280 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n = int(input())

hp = []
for _ in range(n):
  si = input()
  heapq.heappush(hp, si)

ans = []
while len(hp) > 0:
  cur = heapq.heappop(hp)
  if len(cur) == 1 or len(hp) == 0:
    ans.append(cur)
  else:
    ans.append(cur[0])
    heapq.heappush(hp, cur[1:])

print("".join(ans))
0