結果
問題 | No.3074 Divide Points Fairly |
ユーザー |
👑 ![]() |
提出日時 | 2025-03-28 21:37:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 243 ms / 2,000 ms |
コード長 | 974 bytes |
コンパイル時間 | 358 ms |
コンパイル使用メモリ | 82,704 KB |
実行使用メモリ | 84,096 KB |
最終ジャッジ日時 | 2025-03-28 21:38:00 |
合計ジャッジ時間 | 9,359 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
import sysimport randomN = int(input())xy = []for i in range(2*N):x,y = map(int,input().split())xy.append( (x,y) )while True:a = 1b = random.randint(90000,10**5)if random.randint(0,1) == 0:b *= -1if random.randint(0,1) == 0:a,b = b,al = -2*(10**10)r = 2*(10**10)+1while r-l != 1:m = (l+r)//2plus = 0minus = 0for x,y in xy:s = a*x+b*y+mif s < 0:minus += 1elif s > 0:plus += 1if plus > minus:r = melse:l = mfor m in range(l-3,r+4):plus = 0minus = 0for x,y in xy:s = a*x+b*y+mif s < 0:minus += 1elif s > 0:plus += 1if plus == minus == N:print (a,b,m)sys.exit()# print (a,b,m)# assert False