結果

問題 No.205 マージして辞書順最小
ユーザー ayaoniayaoni
提出日時 2021-08-30 22:30:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 69,504 KB
最終ジャッジ日時 2024-05-03 08:31:51
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 36 ms
51,584 KB
testcase_02 AC 45 ms
63,232 KB
testcase_03 AC 40 ms
63,104 KB
testcase_04 AC 39 ms
63,104 KB
testcase_05 AC 39 ms
62,464 KB
testcase_06 AC 32 ms
52,096 KB
testcase_07 AC 42 ms
69,376 KB
testcase_08 AC 42 ms
68,992 KB
testcase_09 AC 42 ms
69,120 KB
testcase_10 AC 51 ms
69,120 KB
testcase_11 AC 50 ms
69,504 KB
testcase_12 AC 48 ms
69,376 KB
testcase_13 AC 43 ms
69,376 KB
testcase_14 AC 35 ms
52,352 KB
testcase_15 AC 34 ms
51,712 KB
testcase_16 AC 33 ms
52,224 KB
testcase_17 AC 33 ms
51,968 KB
testcase_18 AC 34 ms
52,608 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