結果

問題 No.1012 荷物収集
ユーザー NoneNone
提出日時 2021-02-26 20:56:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 348 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 106,892 KB
最終ジャッジ日時 2024-04-10 11:22:51
合計ジャッジ時間 12,495 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,624 KB
testcase_01 AC 37 ms
52,832 KB
testcase_02 AC 38 ms
52,216 KB
testcase_03 AC 38 ms
53,148 KB
testcase_04 AC 207 ms
106,668 KB
testcase_05 AC 206 ms
106,540 KB
testcase_06 AC 206 ms
106,540 KB
testcase_07 AC 210 ms
106,672 KB
testcase_08 AC 205 ms
106,152 KB
testcase_09 AC 206 ms
106,156 KB
testcase_10 AC 206 ms
106,420 KB
testcase_11 AC 208 ms
106,284 KB
testcase_12 AC 205 ms
106,548 KB
testcase_13 AC 205 ms
106,892 KB
testcase_14 AC 47 ms
59,424 KB
testcase_15 AC 56 ms
64,620 KB
testcase_16 AC 49 ms
61,196 KB
testcase_17 AC 53 ms
63,572 KB
testcase_18 AC 52 ms
64,608 KB
testcase_19 AC 45 ms
60,652 KB
testcase_20 AC 45 ms
54,652 KB
testcase_21 AC 49 ms
60,908 KB
testcase_22 AC 51 ms
61,560 KB
testcase_23 AC 49 ms
61,176 KB
testcase_24 AC 249 ms
94,960 KB
testcase_25 AC 315 ms
101,560 KB
testcase_26 AC 254 ms
94,492 KB
testcase_27 AC 127 ms
78,716 KB
testcase_28 AC 327 ms
100,660 KB
testcase_29 AC 284 ms
96,184 KB
testcase_30 AC 344 ms
104,372 KB
testcase_31 AC 139 ms
84,428 KB
testcase_32 AC 158 ms
82,764 KB
testcase_33 AC 178 ms
86,660 KB
testcase_34 AC 174 ms
87,660 KB
testcase_35 AC 294 ms
97,976 KB
testcase_36 AC 155 ms
88,328 KB
testcase_37 AC 266 ms
94,256 KB
testcase_38 AC 261 ms
91,192 KB
testcase_39 AC 176 ms
83,860 KB
testcase_40 AC 181 ms
83,900 KB
testcase_41 AC 348 ms
97,076 KB
testcase_42 AC 201 ms
87,796 KB
testcase_43 AC 265 ms
94,492 KB
testcase_44 AC 38 ms
53,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
N,Q=map(int, input().split())
data=[]
X=[]
for _ in range(N):
    x,w=map(int, input().split())
    data.append((x,w))
    X.append(x)
X.sort()
data.sort(key=lambda x:x[0])
S=[0]
T=[0]
for x,w in data:
    S.append(S[-1]+w)
    T.append(T[-1]+x*w)

for x in map(int, input().split()):
    i=bisect_left(X,x)
    print(S[i]*x-T[i] + (T[-1]-T[i])-x*(S[-1]-S[i]))
0