結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー tanon710tanon710
提出日時 2020-10-15 22:56:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 360 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 124,180 KB
最終ジャッジ日時 2023-09-28 01:28:01
合計ジャッジ時間 20,556 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
70,924 KB
testcase_01 AC 62 ms
71,232 KB
testcase_02 AC 61 ms
71,108 KB
testcase_03 AC 60 ms
71,156 KB
testcase_04 AC 61 ms
71,080 KB
testcase_05 AC 61 ms
71,332 KB
testcase_06 AC 61 ms
71,104 KB
testcase_07 AC 60 ms
71,220 KB
testcase_08 AC 63 ms
71,216 KB
testcase_09 AC 63 ms
71,300 KB
testcase_10 AC 62 ms
71,144 KB
testcase_11 AC 63 ms
71,228 KB
testcase_12 AC 62 ms
71,296 KB
testcase_13 AC 64 ms
71,060 KB
testcase_14 AC 62 ms
71,056 KB
testcase_15 AC 61 ms
71,396 KB
testcase_16 AC 61 ms
71,212 KB
testcase_17 AC 64 ms
71,104 KB
testcase_18 AC 337 ms
124,180 KB
testcase_19 AC 327 ms
121,164 KB
testcase_20 AC 197 ms
101,608 KB
testcase_21 AC 87 ms
76,344 KB
testcase_22 AC 205 ms
99,912 KB
testcase_23 AC 81 ms
76,352 KB
testcase_24 AC 305 ms
123,648 KB
testcase_25 AC 213 ms
100,680 KB
testcase_26 AC 127 ms
90,272 KB
testcase_27 AC 81 ms
76,140 KB
testcase_28 AC 349 ms
123,516 KB
testcase_29 AC 349 ms
123,356 KB
testcase_30 AC 353 ms
123,860 KB
testcase_31 AC 350 ms
123,388 KB
testcase_32 AC 345 ms
123,524 KB
testcase_33 AC 359 ms
123,788 KB
testcase_34 AC 349 ms
123,516 KB
testcase_35 AC 356 ms
123,524 KB
testcase_36 AC 348 ms
123,452 KB
testcase_37 AC 359 ms
123,532 KB
testcase_38 AC 353 ms
123,792 KB
testcase_39 AC 349 ms
123,548 KB
testcase_40 AC 354 ms
123,620 KB
testcase_41 AC 351 ms
123,656 KB
testcase_42 AC 360 ms
123,764 KB
testcase_43 AC 63 ms
71,148 KB
testcase_44 AC 62 ms
71,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ta=list(map(int,input().split()))
tb=list(map(int,input().split()))
ab=[[ta[i],tb[i]] for i in range(n)]
ab=sorted(ab,key=lambda x:x[0])
k=sum(tb)
persuit=(k+1)//2
acum=0
x=-1
for a,b in ab:
    if acum<=persuit<=acum+b:
        x=a
        break
    else:
        acum+=b
ans=0
for a,b in ab:
    ans+=abs(x-a)*b
print(x,ans)
0