結果
問題 |
No.321 (P,Q)-サンタと街の子供たち
|
ユーザー |
![]() |
提出日時 | 2020-03-04 18:44:59 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 33,980 KB |
最終ジャッジ日時 | 2024-10-14 00:23:28 |
合計ジャッジ時間 | 4,402 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 39 RE * 2 |
ソースコード
#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from math import gcd # %% P, Q = map(int, readline().split()) N = int(readline()) m = map(int, read().split()) XY = list(zip(m, m)) # %% d = gcd(P, Q) P //= d Q //= d is_even = (P + Q) % 2 == 0 # %% def check(X, Y, d, is_even): if X % d != 0: return False if Y % d != 0: return False X //= d Y //= d if is_even: return (X + Y) % 2 == 0 else: return True # %% answer = sum(check(x, y, d, is_even) for x, y in XY) print(answer)