結果
| 問題 |
No.849 yuki国の分割統治
|
| コンテスト | |
| ユーザー |
rusa6111
|
| 提出日時 | 2019-07-05 22:07:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 584 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 82,400 KB |
| 実行使用メモリ | 97,008 KB |
| 最終ジャッジ日時 | 2024-10-06 21:50:15 |
| 合計ジャッジ時間 | 6,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | AC * 7 WA * 9 TLE * 1 -- * 9 |
ソースコード
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))
rusa6111