結果
| 問題 |
No.470 Inverse S+T Problem
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:27:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 700 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 82,412 KB |
| 実行使用メモリ | 78,872 KB |
| 最終ジャッジ日時 | 2025-06-12 14:28:05 |
| 合計ジャッジ時間 | 2,968 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 9 |
ソースコード
n = int(input())
u_list = [input().strip() for _ in range(n)]
used = set()
splits = []
possible = True
for u in u_list:
# Try split into S (1 char) and T (2 chars)
s1 = u[0]
t1 = u[1:]
if s1 not in used and t1 not in used:
used.add(s1)
used.add(t1)
splits.append((s1, t1))
else:
# Try split into S (2 chars) and T (1 char)
s2 = u[:2]
t2 = u[2]
if s2 not in used and t2 not in used:
used.add(s2)
used.add(t2)
splits.append((s2, t2))
else:
possible = False
break
if possible:
for s, t in splits:
print(f"{s} {t}")
else:
print("Impossible")
gew1fw