結果

問題 No.1012 荷物収集
ユーザー Ldio03Ldio03
提出日時 2020-03-20 22:47:46
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 1,922 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 101,908 KB
最終ジャッジ日時 2023-08-21 17:52:56
合計ジャッジ時間 15,866 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,332 KB
testcase_01 AC 69 ms
71,396 KB
testcase_02 AC 70 ms
71,400 KB
testcase_03 AC 69 ms
71,476 KB
testcase_04 AC 248 ms
101,896 KB
testcase_05 AC 251 ms
101,652 KB
testcase_06 AC 252 ms
101,668 KB
testcase_07 AC 243 ms
101,796 KB
testcase_08 AC 250 ms
101,908 KB
testcase_09 AC 254 ms
101,812 KB
testcase_10 AC 252 ms
101,656 KB
testcase_11 AC 254 ms
101,776 KB
testcase_12 AC 246 ms
101,752 KB
testcase_13 AC 250 ms
101,884 KB
testcase_14 AC 80 ms
75,336 KB
testcase_15 AC 88 ms
76,080 KB
testcase_16 AC 81 ms
75,400 KB
testcase_17 AC 85 ms
75,952 KB
testcase_18 AC 85 ms
75,756 KB
testcase_19 AC 78 ms
75,208 KB
testcase_20 AC 80 ms
71,308 KB
testcase_21 AC 86 ms
75,452 KB
testcase_22 AC 82 ms
75,468 KB
testcase_23 AC 85 ms
75,316 KB
testcase_24 AC 343 ms
92,932 KB
testcase_25 AC 459 ms
99,620 KB
testcase_26 AC 370 ms
89,308 KB
testcase_27 AC 176 ms
80,636 KB
testcase_28 AC 487 ms
98,488 KB
testcase_29 AC 439 ms
91,444 KB
testcase_30 AC 503 ms
99,880 KB
testcase_31 AC 178 ms
87,104 KB
testcase_32 AC 214 ms
85,128 KB
testcase_33 AC 227 ms
88,904 KB
testcase_34 AC 220 ms
90,116 KB
testcase_35 AC 427 ms
95,328 KB
testcase_36 AC 191 ms
89,852 KB
testcase_37 AC 428 ms
90,704 KB
testcase_38 AC 375 ms
94,316 KB
testcase_39 AC 252 ms
84,960 KB
testcase_40 AC 252 ms
87,192 KB
testcase_41 AC 521 ms
101,908 KB
testcase_42 AC 279 ms
87,988 KB
testcase_43 AC 386 ms
90,804 KB
testcase_44 AC 75 ms
71,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect as bi
n,q=map(int,input().split())
nimotu=[list(map(int,input().split())) for i in range(n)]
nimotu.sort()
pos=[nimotu[i][0] for i in range(n)]
valuesum=[0]*n
weightsum=[0]*n
for i in range(n):
    valuesum[i]=valuesum[i-1]+nimotu[i][0]*nimotu[i][1]
    weightsum[i]=weightsum[i-1]+nimotu[i][1]
a=map(int,input().split())
for x in a:
    point=bi.bisect_left(pos,x)
    if point == n:
        print(x*weightsum[-1]-valuesum[-1])
        continue
    print(abs(x*weightsum[point-1]-valuesum[point-1]+valuesum[-1]-valuesum[point-1]-x*weightsum[-1]+x*weightsum[point-1]))
0