結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 20:26:29 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 651 bytes |
| コンパイル時間 | 138 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 53,652 KB |
| 最終ジャッジ日時 | 2025-03-20 20:27:38 |
| 合計ジャッジ時間 | 1,820 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
S = input().strip()
target_chars = 'abcdefghijklm'
current_counts = {c: 0 for c in target_chars}
for c in S:
current_counts[c] += 1
candidates = []
for char_to_add in target_chars:
new_counts = current_counts.copy()
new_counts[char_to_add] += 1
valid = True
count_of_twos = 0
for c in target_chars:
cnt = new_counts[c]
if cnt < 1 or cnt >= 3:
valid = False
break
if cnt == 2:
count_of_twos += 1
if valid and count_of_twos == 1:
candidates.append(char_to_add)
if not candidates:
print("Impossible")
else:
print('\n'.join(sorted(candidates)))
lam6er