結果
| 問題 |
No.601 Midpoint Erase
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-02 04:07:26 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 961 bytes |
| コンパイル時間 | 283 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 289,444 KB |
| 最終ジャッジ日時 | 2024-11-28 02:37:56 |
| 合計ジャッジ時間 | 32,045 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 1 TLE * 8 MLE * 2 |
ソースコード
import sys
from collections import defaultdict
from itertools import combinations
readline = sys.stdin.readline
N = int(input())
li = tuple(tuple(map(int, readline().split())) for _ in range(N))
MAP = defaultdict(set)
LIST = []
for i, j in combinations(li, 2):
x = (i[0] - j[0])
y = (i[1] - j[1])
if (x % 2 == 0 and y % 2 == 0 and
x not in (-1, 0, 1) and y not in (-1, 0, 1)):
MAP[i].add(j)
MAP[j].add(i)
LIST.append({i, j})
cnt = 0
dp = [LIST[0]] if LIST else []
while dp:
fi, se = dp.pop()
if MAP[fi] and MAP[se]:
for z in MAP[fi]:
MAP[z].remove(fi)
if not MAP[z]:
del MAP[z]
for z in MAP[se]:
MAP[z].remove(se)
if not MAP[z]:
del MAP[z]
del MAP[fi]
del MAP[se]
cnt += 1
if MAP:
t = tuple(MAP)[0]
dp.append((t, min(MAP[t])))
print("Bob" if cnt % 2 == 0 else "Alice")