結果

問題 No.601 Midpoint Erase
ユーザー daku9640daku9640
提出日時 2017-12-02 04:14:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 960 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 217,724 KB
最終ジャッジ日時 2024-05-06 00:54:34
合計ジャッジ時間 4,042 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
16,384 KB
testcase_01 AC 32 ms
11,008 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
from itertools import combinations
readline = sys.stdin.readline
N = int(input())
li = (tuple(map(int, readline().split())) for _ in [0] * N)
MAP = defaultdict(list)
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].append(j)
        MAP[j].append(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, MAP[t][0]))
print("Bob" if cnt % 2 == 0 else "Alice")
0