結果
問題 |
No.205 マージして辞書順最小
|
ユーザー |
![]() |
提出日時 | 2019-09-24 07:24:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-19 04:57:50 |
合計ジャッジ時間 | 1,339 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 5 WA * 10 |
ソースコード
from string import ascii_lowercase N = int(input()) strings = [] re = "" for x in range(N): strings.append(input()) """ ans = "" def cut(str): return str[1:] while ( not all( x == "" for x in strings) ): min = strings[0] for x in strings: if (min[0] > x[0]): min = x ans += min[0] if (cut(min) == ""): strings.pop(strings.index(min)) else: strings[strings.index(min)] = cut(min) print(ans) """ dic = {} for i in ascii_lowercase: dic[i] = 0 for string in strings: for x in string: dic[x] += 1 for key in dic.keys(): re += key*dic[key] print(re)