結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー 👑 rin204rin204
提出日時 2023-02-08 20:42:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 77,768 KB
最終ジャッジ日時 2023-09-20 10:55:38
合計ジャッジ時間 7,078 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 74 ms
71,236 KB
testcase_02 AC 71 ms
71,332 KB
testcase_03 AC 73 ms
71,452 KB
testcase_04 AC 71 ms
71,452 KB
testcase_05 WA -
testcase_06 AC 73 ms
71,392 KB
testcase_07 AC 73 ms
71,628 KB
testcase_08 AC 73 ms
71,796 KB
testcase_09 AC 73 ms
71,564 KB
testcase_10 AC 73 ms
71,624 KB
testcase_11 AC 71 ms
71,540 KB
testcase_12 AC 71 ms
71,320 KB
testcase_13 AC 72 ms
71,368 KB
testcase_14 AC 127 ms
77,584 KB
testcase_15 AC 140 ms
77,504 KB
testcase_16 AC 115 ms
77,452 KB
testcase_17 AC 75 ms
71,404 KB
testcase_18 AC 122 ms
77,400 KB
testcase_19 AC 130 ms
77,596 KB
testcase_20 AC 144 ms
77,524 KB
testcase_21 AC 125 ms
77,360 KB
testcase_22 AC 106 ms
77,540 KB
testcase_23 AC 133 ms
77,472 KB
testcase_24 AC 112 ms
77,768 KB
testcase_25 AC 125 ms
77,468 KB
testcase_26 AC 142 ms
77,652 KB
testcase_27 AC 136 ms
77,324 KB
testcase_28 AC 134 ms
77,584 KB
testcase_29 AC 145 ms
77,536 KB
testcase_30 AC 99 ms
77,116 KB
testcase_31 AC 83 ms
71,172 KB
testcase_32 AC 119 ms
77,308 KB
testcase_33 AC 122 ms
77,608 KB
testcase_34 AC 118 ms
77,620 KB
testcase_35 AC 135 ms
77,520 KB
testcase_36 AC 96 ms
77,080 KB
testcase_37 AC 126 ms
77,604 KB
testcase_38 AC 122 ms
77,288 KB
testcase_39 AC 104 ms
77,472 KB
testcase_40 AC 141 ms
77,564 KB
testcase_41 AC 109 ms
77,288 KB
testcase_42 AC 134 ms
77,612 KB
testcase_43 AC 117 ms
77,460 KB
testcase_44 AC 130 ms
77,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

p, q = map(int, input().split())

if p == 0 and q == 0:
    ans = 0
    n = int(input())
    for _ in range(n):
        x, y = map(int, input().split())
        if x == y == 0:
            ans += 1
    exit()

g = gcd(p, q)
p //= g
q //= g
if (p + q) % 2 == 0:
    bi = True
else:
    bi = False
n = int(input())
ans = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x % g != 0 or y % g != 0:
        continue
    x //= g
    y //= g
    if not bi or (x + y) % 2 == 0:
        ans += 1
print(ans)
0