結果

問題 No.3074 Divide Points Fairly
ユーザー 👑 p-adic
提出日時 2025-02-16 20:11:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,415 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 30,592 KB
最終ジャッジ日時 2025-03-27 12:52:55
合計ジャッジ時間 36,762 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:19: SyntaxWarning: invalid decimal literal
  if h<1and d==N:exit(print(a,b,r))

ソースコード

diff #

import random
R=range
J=lambda:list(map(int,input().split()))
N,*_=J()
P=[J()for i in R(N*2)]
L=9**5
C=L*L
def D(c):
	h=d=0
	for x,y in P:v=a*x+b*y+c;h|=v==0;d+=v>0
	return h,d
while 1:
	a,b,l,r=random.randint(1,L),random.randint(-L,L),-C-1,C
	while l+1<r:
		m=(l+r)>>1;h,d=D(m)
		if d<N:l=m
		else:r=m
	h,d=D(r)
	if h<1and d==N:exit(print(a,b,r))
0