結果
問題 | No.1251 絶対に間違ってはいけない最小化問題 |
ユーザー | uni_python |
提出日時 | 2020-10-09 22:06:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 874 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 87,240 KB |
実行使用メモリ | 109,856 KB |
最終ジャッジ日時 | 2023-09-27 17:19:09 |
合計ジャッジ時間 | 52,276 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
76,268 KB |
testcase_01 | AC | 70 ms
76,680 KB |
testcase_02 | AC | 68 ms
76,476 KB |
testcase_03 | AC | 69 ms
76,572 KB |
testcase_04 | AC | 71 ms
76,756 KB |
testcase_05 | AC | 69 ms
76,636 KB |
testcase_06 | AC | 69 ms
76,676 KB |
testcase_07 | AC | 69 ms
76,588 KB |
testcase_08 | AC | 71 ms
76,448 KB |
testcase_09 | AC | 69 ms
76,348 KB |
testcase_10 | AC | 68 ms
76,612 KB |
testcase_11 | AC | 70 ms
76,468 KB |
testcase_12 | AC | 68 ms
76,524 KB |
testcase_13 | AC | 70 ms
76,552 KB |
testcase_14 | AC | 75 ms
76,676 KB |
testcase_15 | AC | 70 ms
76,620 KB |
testcase_16 | AC | 70 ms
76,468 KB |
testcase_17 | AC | 70 ms
76,692 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 214 ms
76,672 KB |
testcase_22 | WA | - |
testcase_23 | AC | 173 ms
76,816 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 180 ms
76,628 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 72 ms
76,400 KB |
testcase_44 | AC | 70 ms
76,612 KB |
ソースコード
import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): import bisect N=I() A=LI() B=LI() def calc(x): temp=0 for i in range(N): temp+=B[i]*abs(x-A[i]) return temp M=10**6+5 left=-M right=M for i in range(1000): c1=(2*left+right)/3 c2=(left+2*right)/3 if calc(c1)<calc(c2): right=c2 else: left=c1 aaa=int((right+left)/2) ans=10**20 ansx=0 for i in range(10): ii=i-5 x=aaa+0.5*ii temp=calc(x) if temp<ans: ans=temp ansx=x print(ansx,int(ans)) main()