結果

問題 No.205 マージして辞書順最小
ユーザー ayaoniayaoni
提出日時 2021-08-30 22:30:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 92 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,332 KB
実行使用メモリ 76,464 KB
最終ジャッジ日時 2023-08-15 22:03:30
合計ジャッジ時間 3,063 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,196 KB
testcase_01 AC 73 ms
71,376 KB
testcase_02 AC 85 ms
76,312 KB
testcase_03 AC 82 ms
76,368 KB
testcase_04 AC 82 ms
76,308 KB
testcase_05 AC 84 ms
76,424 KB
testcase_06 AC 77 ms
71,344 KB
testcase_07 AC 86 ms
76,084 KB
testcase_08 AC 84 ms
76,200 KB
testcase_09 AC 82 ms
76,400 KB
testcase_10 AC 92 ms
76,464 KB
testcase_11 AC 92 ms
76,184 KB
testcase_12 AC 90 ms
76,460 KB
testcase_13 AC 83 ms
75,968 KB
testcase_14 AC 75 ms
71,412 KB
testcase_15 AC 74 ms
71,340 KB
testcase_16 AC 75 ms
71,248 KB
testcase_17 AC 79 ms
71,356 KB
testcase_18 AC 76 ms
71,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
S = [S()+'{' for _ in range(N)]

ANS = []
while True:
    S.sort()
    if S[0] == '{':
        break
    ANS.append(S[0][0])
    new_S = [S[0][1:]]
    for s in S[1:]:
        new_S.append(s)
    S = new_S

ans = ''.join(ANS)
print(ans)
0