結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー maspymaspy
提出日時 2020-03-04 18:44:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 632 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,980 KB
最終ジャッジ日時 2024-04-22 01:46:07
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 RE -
testcase_06 AC 33 ms
10,880 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 28 ms
10,752 KB
testcase_10 AC 27 ms
10,880 KB
testcase_11 AC 29 ms
10,752 KB
testcase_12 AC 27 ms
10,880 KB
testcase_13 AC 28 ms
10,752 KB
testcase_14 AC 91 ms
24,792 KB
testcase_15 AC 131 ms
33,980 KB
testcase_16 AC 63 ms
19,776 KB
testcase_17 AC 28 ms
10,752 KB
testcase_18 AC 73 ms
21,860 KB
testcase_19 AC 87 ms
25,456 KB
testcase_20 AC 116 ms
33,656 KB
testcase_21 AC 91 ms
23,988 KB
testcase_22 AC 43 ms
14,448 KB
testcase_23 AC 112 ms
29,988 KB
testcase_24 AC 47 ms
15,424 KB
testcase_25 AC 77 ms
23,468 KB
testcase_26 AC 114 ms
32,768 KB
testcase_27 AC 92 ms
27,164 KB
testcase_28 AC 93 ms
26,704 KB
testcase_29 AC 128 ms
33,980 KB
testcase_30 AC 30 ms
11,392 KB
testcase_31 AC 29 ms
10,880 KB
testcase_32 AC 81 ms
22,512 KB
testcase_33 AC 75 ms
22,036 KB
testcase_34 AC 63 ms
18,844 KB
testcase_35 AC 112 ms
28,384 KB
testcase_36 AC 29 ms
11,520 KB
testcase_37 AC 83 ms
24,764 KB
testcase_38 AC 73 ms
21,888 KB
testcase_39 AC 44 ms
13,912 KB
testcase_40 AC 114 ms
32,332 KB
testcase_41 AC 54 ms
16,144 KB
testcase_42 AC 101 ms
29,460 KB
testcase_43 AC 66 ms
19,588 KB
testcase_44 AC 96 ms
27,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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)
0