結果

問題 No.205 マージして辞書順最小
ユーザー roarisroaris
提出日時 2019-12-06 09:25:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 394 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 8,004 KB
最終ジャッジ日時 2023-08-24 19:45:29
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,824 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
7,804 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
7,836 KB
testcase_11 AC 40 ms
7,800 KB
testcase_12 WA -
testcase_13 AC 27 ms
7,800 KB
testcase_14 AC 16 ms
7,948 KB
testcase_15 AC 15 ms
7,824 KB
testcase_16 AC 16 ms
7,812 KB
testcase_17 AC 16 ms
7,824 KB
testcase_18 AC 16 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

while S:
    S.sort()
    l = [Si for Si in S if Si[0]==S[0][0]]
    
    for i in range(len(l)):
        if len(l[i])!=1:
            mark = i
            break
    else:
        mark = 0
    
    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