結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー googol_S0googol_S0
提出日時 2020-10-09 21:42:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 126,200 KB
最終ジャッジ日時 2023-09-27 15:55:03
合計ジャッジ時間 16,551 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
91,184 KB
testcase_01 AC 76 ms
91,204 KB
testcase_02 AC 73 ms
91,284 KB
testcase_03 AC 73 ms
91,200 KB
testcase_04 AC 71 ms
91,208 KB
testcase_05 AC 72 ms
91,204 KB
testcase_06 AC 76 ms
91,076 KB
testcase_07 AC 77 ms
91,200 KB
testcase_08 AC 75 ms
91,068 KB
testcase_09 AC 74 ms
91,156 KB
testcase_10 AC 72 ms
91,468 KB
testcase_11 AC 77 ms
91,156 KB
testcase_12 AC 74 ms
91,480 KB
testcase_13 AC 78 ms
91,032 KB
testcase_14 AC 76 ms
91,236 KB
testcase_15 AC 75 ms
91,252 KB
testcase_16 AC 75 ms
91,212 KB
testcase_17 AC 73 ms
91,160 KB
testcase_18 AC 174 ms
125,884 KB
testcase_19 AC 146 ms
121,848 KB
testcase_20 AC 120 ms
106,636 KB
testcase_21 AC 84 ms
92,240 KB
testcase_22 AC 119 ms
107,724 KB
testcase_23 AC 86 ms
92,036 KB
testcase_24 AC 142 ms
115,740 KB
testcase_25 AC 119 ms
106,680 KB
testcase_26 AC 96 ms
100,248 KB
testcase_27 AC 82 ms
92,020 KB
testcase_28 AC 151 ms
126,072 KB
testcase_29 AC 157 ms
125,956 KB
testcase_30 AC 153 ms
126,012 KB
testcase_31 AC 158 ms
126,020 KB
testcase_32 AC 151 ms
126,200 KB
testcase_33 AC 156 ms
126,168 KB
testcase_34 AC 152 ms
126,100 KB
testcase_35 AC 153 ms
126,104 KB
testcase_36 AC 156 ms
125,756 KB
testcase_37 AC 155 ms
126,168 KB
testcase_38 AC 152 ms
126,064 KB
testcase_39 AC 153 ms
126,116 KB
testcase_40 AC 157 ms
125,964 KB
testcase_41 AC 154 ms
125,884 KB
testcase_42 AC 155 ms
126,148 KB
testcase_43 AC 74 ms
91,212 KB
testcase_44 AC 73 ms
91,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
for i in range(N):
  A[i]+=10**6
C=[0]*(2*10**6+1)
for i in range(N):
  C[A[i]]+=B[i]
D=0
E=sum(B)
X=0
for i in range(len(C)):
  D+=C[i]
  if D>=(E+1)//2:
    X=i
    break
P=0
for i in range(N):
  P+=B[i]*abs(X-A[i])
print(X-10**6,P)
0