結果

問題 No.601 Midpoint Erase
ユーザー mokraimokrai
提出日時 2017-12-01 06:52:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 977 ms / 2,000 ms
コード長 1,053 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 21,264 KB
最終ジャッジ日時 2023-08-18 14:09:57
合計ジャッジ時間 6,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,756 KB
testcase_01 AC 14 ms
7,780 KB
testcase_02 AC 15 ms
7,768 KB
testcase_03 AC 457 ms
16,216 KB
testcase_04 AC 553 ms
17,520 KB
testcase_05 AC 323 ms
14,832 KB
testcase_06 AC 140 ms
11,848 KB
testcase_07 AC 507 ms
16,976 KB
testcase_08 AC 397 ms
15,672 KB
testcase_09 AC 533 ms
17,292 KB
testcase_10 AC 68 ms
10,184 KB
testcase_11 AC 977 ms
21,264 KB
testcase_12 AC 320 ms
13,976 KB
testcase_13 AC 17 ms
7,788 KB
testcase_14 AC 16 ms
7,772 KB
testcase_15 AC 17 ms
7,808 KB
testcase_16 AC 13 ms
7,908 KB
testcase_17 AC 13 ms
7,804 KB
testcase_18 AC 13 ms
7,764 KB
testcase_19 AC 13 ms
7,784 KB
testcase_20 AC 12 ms
7,808 KB
testcase_21 AC 12 ms
7,768 KB
testcase_22 AC 12 ms
7,812 KB
testcase_23 AC 12 ms
7,772 KB
testcase_24 AC 12 ms
7,800 KB
testcase_25 AC 12 ms
7,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    points = []
    for i in range(N):
       x, y = map(int, input().split()) 
       points.append((x,y))
    #print(points)

    game_count = 0
    flag = True
    while flag == True:
        points = find_erase_points(points)
        if points is None:
            flag = False
        else:
            game_count += 1

    if game_count == 0:
        print("Bob")
    elif game_count % 2 == 1:
        print("Alice")
    else:
        print("Bob")

def find_erase_points(points):
    if len(points) == 0 or len(points) == 1:
        return None

    for (i, point) in enumerate(points):
        x, y = point
        for (j, point2) in enumerate(points):
            x2, y2 = point2
            x_dist = abs(x2 - x)
            y_dist = abs(y2 - y)
            if x_dist == 0 and y_dist == 0:
                continue
            if x_dist % 2 == 0 and y_dist % 2 == 0:
                del points[j]
                del points[i]
                return points
    return None

if __name__ == '__main__':
    main()
0