結果

問題 No.849 yuki国の分割統治
ユーザー convexineqconvexineq
提出日時 2019-07-05 22:14:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 928 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 44,100 KB
最終ジャッジ日時 2024-04-16 07:33:02
合計ジャッジ時間 9,751 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
10,880 KB
testcase_01 AC 34 ms
10,752 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 31 ms
10,880 KB
testcase_05 AC 33 ms
10,880 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 405 ms
31,876 KB
testcase_09 AC 411 ms
31,056 KB
testcase_10 AC 449 ms
29,312 KB
testcase_11 AC 384 ms
29,456 KB
testcase_12 AC 417 ms
28,032 KB
testcase_13 AC 440 ms
31,992 KB
testcase_14 AC 430 ms
29,568 KB
testcase_15 AC 410 ms
30,416 KB
testcase_16 AC 440 ms
37,588 KB
testcase_17 AC 439 ms
27,520 KB
testcase_18 AC 407 ms
37,976 KB
testcase_19 AC 424 ms
29,696 KB
testcase_20 AC 472 ms
34,904 KB
testcase_21 AC 392 ms
27,264 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 429 ms
43,432 KB
testcase_26 AC 30 ms
10,880 KB
testcase_27 AC 30 ms
11,008 KB
testcase_28 AC 31 ms
10,880 KB
testcase_29 AC 30 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

from math import gcd

a,b,c,d = [int(i) for i in readline().split()]
n = int(input())
xy = [[int(i) for i in readline().split()] for _ in range(n)]


def heikouidou(x,y,pp,qq,g,h): #(e,f)に沿って(g,h)以上のぎりぎり
    m = (x*h-y*g)//(h*pp-g*qq)
    x -= m*pp
    y-= m*qq
    return (x,y)
    
    
    
if a*d == b*c:
    if a==0 and c==0:
        g = gcd(b,d)
    else: g = gcd(a,c)
#    print(a,b,c,d,g)
#    assert b%g==0
    p,q = a//g, b//g
    s = set()
    for x,y in xy:
        s.add(heikouidou(x,y,p,q,-q,p))
    print(len(s))
#    print(s)
    exit()

        
s = set()
for x,y in xy:
#    print(x,y)
    x,y = heikouidou(x,y,a,b,c,d)
#    print(x,y)
    x,y = heikouidou(x,y,c,d,a,b)
#    print(x,y)
    s.add((x,y))
print(len(s))
#print(s)
exit()




         
0