結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー proriboneproribone
提出日時 2020-10-09 21:39:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 335 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 87,396 KB
実行使用メモリ 111,264 KB
最終ジャッジ日時 2023-09-27 15:48:38
合計ジャッジ時間 19,379 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
72,040 KB
testcase_01 AC 59 ms
71,700 KB
testcase_02 AC 64 ms
76,052 KB
testcase_03 AC 65 ms
75,836 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 68 ms
76,064 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 65 ms
76,088 KB
testcase_11 WA -
testcase_12 AC 66 ms
76,016 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 67 ms
76,100 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 295 ms
110,644 KB
testcase_19 WA -
testcase_20 AC 195 ms
102,316 KB
testcase_21 AC 87 ms
77,036 KB
testcase_22 WA -
testcase_23 AC 83 ms
76,712 KB
testcase_24 WA -
testcase_25 AC 204 ms
101,448 KB
testcase_26 WA -
testcase_27 AC 84 ms
77,016 KB
testcase_28 WA -
testcase_29 AC 307 ms
111,048 KB
testcase_30 AC 300 ms
110,980 KB
testcase_31 AC 307 ms
111,016 KB
testcase_32 AC 302 ms
111,108 KB
testcase_33 WA -
testcase_34 AC 300 ms
111,072 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 308 ms
110,948 KB
testcase_39 AC 303 ms
110,812 KB
testcase_40 AC 307 ms
111,048 KB
testcase_41 AC 306 ms
111,064 KB
testcase_42 WA -
testcase_43 AC 64 ms
71,588 KB
testcase_44 AC 70 ms
76,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)))
0