結果
問題 |
No.1251 絶対に間違ってはいけない最小化問題
|
ユーザー |
![]() |
提出日時 | 2020-10-09 21:39:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 335 bytes |
コンパイル時間 | 132 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 109,940 KB |
最終ジャッジ日時 | 2024-07-20 10:00:00 |
合計ジャッジ時間 | 16,371 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 20 |
ソースコード
def point(X): res=0 for i in range(N): res+=B[i]*abs(X-A[i]) return res N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) l,r=-10**6,10**6 while(r-l>10**-9): c1,c2=(l*2+r)/3,(l+r*2)/3 if point(c1)>=point(c2): l=c1 else: r=c2 print(int(r),point(int(r)))