結果

問題 No.1012 荷物収集
ユーザー otamay6otamay6
提出日時 2019-11-27 19:41:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 820 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 38,812 KB
最終ジャッジ日時 2024-04-22 13:13:49
合計ジャッジ時間 19,616 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 26 ms
10,496 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 615 ms
38,648 KB
testcase_05 AC 625 ms
38,776 KB
testcase_06 AC 618 ms
38,680 KB
testcase_07 AC 618 ms
38,808 KB
testcase_08 AC 622 ms
38,808 KB
testcase_09 AC 629 ms
38,812 KB
testcase_10 AC 635 ms
38,144 KB
testcase_11 AC 647 ms
38,144 KB
testcase_12 AC 622 ms
38,680 KB
testcase_13 AC 626 ms
38,648 KB
testcase_14 AC 29 ms
10,624 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 28 ms
10,752 KB
testcase_17 AC 27 ms
10,880 KB
testcase_18 AC 29 ms
10,752 KB
testcase_19 AC 28 ms
10,624 KB
testcase_20 AC 30 ms
10,624 KB
testcase_21 AC 31 ms
10,752 KB
testcase_22 AC 29 ms
10,752 KB
testcase_23 AC 31 ms
10,752 KB
testcase_24 AC 517 ms
25,856 KB
testcase_25 AC 703 ms
32,452 KB
testcase_26 AC 424 ms
28,008 KB
testcase_27 AC 114 ms
15,232 KB
testcase_28 AC 717 ms
34,920 KB
testcase_29 AC 485 ms
33,112 KB
testcase_30 AC 753 ms
35,880 KB
testcase_31 AC 197 ms
18,212 KB
testcase_32 AC 211 ms
17,864 KB
testcase_33 AC 301 ms
20,556 KB
testcase_34 AC 309 ms
21,360 KB
testcase_35 AC 607 ms
32,144 KB
testcase_36 AC 261 ms
20,244 KB
testcase_37 AC 445 ms
32,148 KB
testcase_38 AC 548 ms
27,188 KB
testcase_39 AC 254 ms
19,824 KB
testcase_40 AC 282 ms
19,652 KB
testcase_41 AC 820 ms
35,508 KB
testcase_42 AC 348 ms
21,072 KB
testcase_43 AC 502 ms
28,668 KB
testcase_44 AC 26 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N,Q = map(int,input().split())
A=[(0,0)]
for i in range(N):
    a,b=map(int,input().split())
    A.append((a,b))
A.sort()
X = list(map(int,input().split()))

Sxw = [0]
Sw = [0]
for i in range(N+1):
    Sxw.append(Sxw[i]+A[i][0]*A[i][1])
    Sw.append(Sw[i]+A[i][1])

k = 0
for q in range(Q):
    k=bisect.bisect_left(A,(X[q],0))
    print(Sxw[N+1]-2*Sxw[k]+X[q]*(2*Sw[k]-Sw[N+1]))
0