結果
問題 | No.601 Midpoint Erase |
ユーザー |
|
提出日時 | 2017-12-01 06:52:00 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,211 ms / 2,000 ms |
コード長 | 1,053 bytes |
コンパイル時間 | 82 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 23,552 KB |
最終ジャッジ日時 | 2024-11-27 19:45:15 |
合計ジャッジ時間 | 7,048 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
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()