結果
| 問題 |
No.849 yuki国の分割統治
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2019-07-12 07:11:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 773 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 49,952 KB |
| 最終ジャッジ日時 | 2024-10-07 01:48:04 |
| 合計ジャッジ時間 | 7,517 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 RE * 1 |
ソースコード
import sys
import math
input = sys.stdin.readline
def lcm(a,b):
return a*b//math.gcd(a,b)
a,b,c,d=map(int,input().split())
N=int(input())
P=[list(map(int,input().split())) for i in range(N)]
if a*d-b*c==0:
a1=math.gcd(a,c)
b1=b//(a//a1)
def rep_point(p,q):
k=p//a1
return p-k*a1,q-k*b1
Q=[rep_point(P[i][0],P[i][1]) for i in range(N)]
print(len(set(Q)))
sys.exit()
x = lcm(a,c)
if a==0:
t=abs(b)
a,b=c,d
else:
while c!=0:
if a>c:
a,b,c,d=c,d,a,b
r,q=divmod(c,a)
c,d=q,d-b*r
t = abs(d)
def rep_point(p,q):
k=p//a
p-=k*a
q-=k*b
q=q%t
return p,q
Q=[rep_point(P[i][0],P[i][1]) for i in range(N)]
print(len(set(Q)))
titia