結果

問題 No.205 マージして辞書順最小
ユーザー roiti46roiti46
提出日時 2015-05-08 23:49:32
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 6,080 KB
最終ジャッジ日時 2023-09-19 09:02:24
合計ジャッジ時間 1,762 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,864 KB
testcase_01 AC 11 ms
5,860 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 11 ms
5,920 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 14 ms
6,012 KB
testcase_11 AC 18 ms
5,948 KB
testcase_12 AC 18 ms
5,992 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 12 ms
5,832 KB
testcase_16 AC 11 ms
5,932 KB
testcase_17 WA -
testcase_18 AC 12 ms
5,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
S = sorted([raw_input() for i in xrange(N)])
T = ""

for i in xrange(N):
    s = S.pop(0)
    j = 0
    for si in s:
        for i in xrange(j, len(T)):
            if T[i] >= si:
                T = T[:i] + si + T[i:]
                j = i + 1
                break
        else:
            T += si
            j = i + 1
print T
0