結果

問題 No.205 マージして辞書順最小
ユーザー roarisroaris
提出日時 2019-12-06 09:40:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-24 19:46:15
合計ジャッジ時間 1,624 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,808 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
7,796 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 21 ms
7,796 KB
testcase_11 AC 24 ms
7,916 KB
testcase_12 WA -
testcase_13 AC 50 ms
7,780 KB
testcase_14 AC 15 ms
7,920 KB
testcase_15 AC 15 ms
7,796 KB
testcase_16 AC 15 ms
7,780 KB
testcase_17 AC 15 ms
7,816 KB
testcase_18 AC 15 ms
7,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = [input() for _ in range(N)]
ans = ''

while S:
    S.sort()
    mark = 0
    
    for i in range(1, len(S)):
        if len(S[i])>=len(S[0]) and S[i][:len(S[0])]==S[0]:
            mark = i
            break
    
    ans += S[mark][0]
    S[mark] = S[mark][1:]
    
    if S[mark]=='':
        S = [S[i] for i in range(len(S)) if i!=mark]
    
print(ans)
0