結果

問題 No.1012 荷物収集
ユーザー amyuamyu
提出日時 2020-03-20 22:30:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 657 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 42,484 KB
最終ジャッジ日時 2023-08-21 17:17:02
合計ジャッジ時間 14,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,100 KB
testcase_01 AC 16 ms
8,100 KB
testcase_02 AC 16 ms
7,956 KB
testcase_03 AC 16 ms
8,104 KB
testcase_04 AC 403 ms
42,360 KB
testcase_05 AC 397 ms
42,424 KB
testcase_06 AC 394 ms
42,484 KB
testcase_07 AC 398 ms
42,336 KB
testcase_08 AC 400 ms
42,428 KB
testcase_09 AC 401 ms
42,284 KB
testcase_10 AC 392 ms
42,392 KB
testcase_11 AC 399 ms
42,396 KB
testcase_12 AC 398 ms
42,400 KB
testcase_13 AC 396 ms
42,368 KB
testcase_14 AC 16 ms
8,080 KB
testcase_15 AC 19 ms
7,872 KB
testcase_16 AC 18 ms
7,976 KB
testcase_17 AC 19 ms
7,976 KB
testcase_18 AC 18 ms
8,092 KB
testcase_19 AC 17 ms
7,948 KB
testcase_20 AC 17 ms
7,920 KB
testcase_21 AC 17 ms
8,060 KB
testcase_22 AC 18 ms
8,000 KB
testcase_23 AC 18 ms
7,948 KB
testcase_24 AC 431 ms
27,768 KB
testcase_25 AC 602 ms
35,496 KB
testcase_26 AC 284 ms
26,652 KB
testcase_27 AC 61 ms
12,616 KB
testcase_28 AC 571 ms
36,092 KB
testcase_29 AC 284 ms
31,016 KB
testcase_30 AC 592 ms
37,964 KB
testcase_31 AC 177 ms
16,096 KB
testcase_32 AC 167 ms
16,808 KB
testcase_33 AC 268 ms
19,936 KB
testcase_34 AC 273 ms
20,084 KB
testcase_35 AC 483 ms
32,672 KB
testcase_36 AC 220 ms
17,992 KB
testcase_37 AC 272 ms
29,308 KB
testcase_38 AC 446 ms
29,480 KB
testcase_39 AC 188 ms
18,852 KB
testcase_40 AC 221 ms
19,624 KB
testcase_41 AC 657 ms
39,144 KB
testcase_42 AC 286 ms
22,108 KB
testcase_43 AC 401 ms
29,228 KB
testcase_44 AC 16 ms
7,948 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