結果

問題 No.205 マージして辞書順最小
ユーザー Ryuto
提出日時 2018-07-27 16:33:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,448 KB
実行使用メモリ 64,344 KB
最終ジャッジ日時 2024-07-01 03:32:18
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
words = []
for i in range(n):
    words.append(input().strip())
words = [w+'z'*50 for w in words]

ans = ''
while len(words) > 0:
    words.sort()
    ans += words[0][0]
    if len(words[0]) == 51:
        words.pop(0)
    else:
        words[0] = words[0][1:]

print(ans)
0