結果

問題 No.849 yuki国の分割統治
ユーザー rusa6111rusa6111
提出日時 2019-07-05 22:07:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 95,488 KB
最終ジャッジ日時 2024-04-16 07:25:32
合計ジャッジ時間 7,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
58,112 KB
testcase_01 AC 42 ms
53,120 KB
testcase_02 AC 44 ms
53,632 KB
testcase_03 AC 45 ms
53,632 KB
testcase_04 AC 49 ms
60,672 KB
testcase_05 AC 51 ms
61,440 KB
testcase_06 AC 41 ms
52,352 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def f(a,b,p,c,d,q):
    if a*d-b*c==0:
        return p*c==q*a
    else:
    	x=(p*d-b*q)/(a*d-b*c)
    	y=(a*q-p*c)/(a*d-b*c)
    	if math.isclose(x,round(x)) and math.isclose(y,round(y)):
    		return True
    	else:
    		return False

a,b,c,d=tuple(map(int,input().split()))
n=int(input())
live=[]
for i in range(n):
	live.append(list(map(int,input().split())))

group=[]

for i in live:
	notingroup=True
	for j in group:
		k=j[0]
		if f(a,c,k[0]-i[0],b,d,k[1]-i[1]):
			j.append(i)
			notingroup=False
			break
	if notingroup:
		group.append([i])

print(len(group))
0