結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー proriboneproribone
提出日時 2020-10-09 22:12:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 110,704 KB
最終ジャッジ日時 2023-09-27 17:38:28
合計ジャッジ時間 18,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,420 KB
testcase_01 AC 65 ms
71,528 KB
testcase_02 AC 65 ms
71,512 KB
testcase_03 AC 66 ms
71,632 KB
testcase_04 AC 68 ms
71,184 KB
testcase_05 AC 68 ms
71,428 KB
testcase_06 AC 69 ms
71,252 KB
testcase_07 AC 68 ms
71,420 KB
testcase_08 AC 71 ms
75,460 KB
testcase_09 AC 70 ms
75,592 KB
testcase_10 AC 75 ms
75,388 KB
testcase_11 AC 68 ms
71,592 KB
testcase_12 AC 73 ms
75,360 KB
testcase_13 AC 73 ms
75,588 KB
testcase_14 AC 71 ms
75,656 KB
testcase_15 AC 72 ms
75,716 KB
testcase_16 AC 74 ms
75,676 KB
testcase_17 AC 72 ms
75,736 KB
testcase_18 AC 245 ms
110,240 KB
testcase_19 AC 218 ms
106,204 KB
testcase_20 AC 160 ms
102,080 KB
testcase_21 AC 86 ms
76,228 KB
testcase_22 AC 182 ms
99,844 KB
testcase_23 AC 84 ms
76,328 KB
testcase_24 AC 207 ms
102,916 KB
testcase_25 AC 158 ms
101,116 KB
testcase_26 AC 105 ms
84,452 KB
testcase_27 AC 79 ms
76,388 KB
testcase_28 AC 242 ms
110,392 KB
testcase_29 AC 256 ms
110,152 KB
testcase_30 AC 234 ms
110,704 KB
testcase_31 AC 235 ms
110,312 KB
testcase_32 AC 235 ms
110,324 KB
testcase_33 AC 240 ms
110,464 KB
testcase_34 AC 244 ms
110,520 KB
testcase_35 AC 243 ms
110,408 KB
testcase_36 AC 244 ms
110,356 KB
testcase_37 AC 246 ms
110,420 KB
testcase_38 AC 243 ms
110,440 KB
testcase_39 AC 239 ms
110,268 KB
testcase_40 AC 239 ms
110,500 KB
testcase_41 AC 236 ms
110,400 KB
testcase_42 AC 245 ms
110,664 KB
testcase_43 AC 68 ms
71,432 KB
testcase_44 AC 68 ms
71,600 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()))

From,To=-10**8,10**8
while(To-From>1):
    mid=(From+To)//2
    if point(mid)-point(mid-1)<0:
        From=mid
    else:
        To=mid
print(From,point(From))
0