結果

問題 No.1012 荷物収集
ユーザー amyuamyu
提出日時 2020-03-20 22:30:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 696 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 43,508 KB
最終ジャッジ日時 2024-05-08 22:46:18
合計ジャッジ時間 16,276 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 466 ms
43,380 KB
testcase_05 AC 483 ms
43,508 KB
testcase_06 AC 472 ms
43,380 KB
testcase_07 AC 482 ms
43,508 KB
testcase_08 AC 475 ms
43,380 KB
testcase_09 AC 487 ms
43,380 KB
testcase_10 AC 461 ms
43,508 KB
testcase_11 AC 472 ms
43,504 KB
testcase_12 AC 471 ms
43,428 KB
testcase_13 AC 484 ms
43,504 KB
testcase_14 AC 32 ms
10,752 KB
testcase_15 AC 32 ms
10,880 KB
testcase_16 AC 30 ms
10,880 KB
testcase_17 AC 31 ms
10,880 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 30 ms
10,752 KB
testcase_20 AC 30 ms
10,624 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 31 ms
10,624 KB
testcase_24 AC 449 ms
30,280 KB
testcase_25 AC 616 ms
38,116 KB
testcase_26 AC 315 ms
29,236 KB
testcase_27 AC 86 ms
15,232 KB
testcase_28 AC 612 ms
38,812 KB
testcase_29 AC 335 ms
33,356 KB
testcase_30 AC 621 ms
40,548 KB
testcase_31 AC 205 ms
18,580 KB
testcase_32 AC 190 ms
19,348 KB
testcase_33 AC 289 ms
22,620 KB
testcase_34 AC 309 ms
22,716 KB
testcase_35 AC 513 ms
35,152 KB
testcase_36 AC 257 ms
20,692 KB
testcase_37 AC 313 ms
31,892 KB
testcase_38 AC 465 ms
32,032 KB
testcase_39 AC 206 ms
21,476 KB
testcase_40 AC 244 ms
22,164 KB
testcase_41 AC 696 ms
41,608 KB
testcase_42 AC 300 ms
24,560 KB
testcase_43 AC 426 ms
31,520 KB
testcase_44 AC 32 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
from bisect import bisect
n,q=map(int,input().split())
l=[tuple(map(int,input().split())) for i in range(n)]
l.sort()
aw=[0]
axw=[0]
for x,w in l:
    aw.append(aw[-1]+w)
    axw.append(axw[-1]+x*w)
x=list(map(int,input().split()))
for i in x:
    t=bisect(l,(i,0))
    print(i*aw[t]-axw[t]+axw[n]-axw[t]-i*(aw[n]-aw[t]))
0