結果
| 問題 |
No.470 Inverse S+T Problem
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:21:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 731 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 82,308 KB |
| 実行使用メモリ | 79,316 KB |
| 最終ジャッジ日時 | 2025-03-31 17:22:15 |
| 合計ジャッジ時間 | 3,385 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 9 |
ソースコード
n = int(input())
strings = [input().strip() for _ in range(n)]
used = set()
result = []
possible = True
for u in strings:
s1 = u[0]
t1 = u[1:3]
found = False
# Check candidate A (1, 2)
if s1 not in used and t1 not in used:
used.add(s1)
used.add(t1)
result.append(f"{s1} {t1}")
found = True
else:
# Check candidate B (2,1)
s2 = u[0:2]
t2 = u[2]
if s2 not in used and t2 not in used:
used.add(s2)
used.add(t2)
result.append(f"{s2} {t2}")
found = True
if not found:
possible = False
break
if possible:
for line in result:
print(line)
else:
print("Impossible")
lam6er