結果
| 問題 | No.2715 Unique Chimatagram |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-05 22:34:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 684 bytes |
| 記録 | |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 82,512 KB |
| 実行使用メモリ | 65,828 KB |
| 最終ジャッジ日時 | 2024-10-01 02:44:38 |
| 合計ジャッジ時間 | 6,832 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 28 |
ソースコード
def find_string(strings):
char_count = {}
for string in strings:
for char in string:
char_count[char] = char_count.get(char, 0) + 1
unique_char = None
for char, count in char_count.items():
if count == 1:
unique_char = char
break
if unique_char is None:
return -1
for string in strings:
if unique_char in string:
string += unique_char
return ''.join(sorted(string))
N = int(input())
strings = []
for _ in range(N):
strings.append(input().strip())
result = find_string(strings)
print(result)
#rock→rockk→ckkorと入れ替えることで可能、って感じ?