結果

問題 No.1012 荷物収集
ユーザー titiatitia
提出日時 2020-03-21 04:14:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 659 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 48,324 KB
最終ジャッジ日時 2024-05-09 17:57:16
合計ジャッジ時間 22,855 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 33 ms
10,880 KB
testcase_04 AC 796 ms
48,292 KB
testcase_05 AC 805 ms
48,300 KB
testcase_06 AC 797 ms
48,320 KB
testcase_07 AC 803 ms
48,168 KB
testcase_08 AC 789 ms
48,324 KB
testcase_09 AC 805 ms
48,292 KB
testcase_10 AC 797 ms
48,192 KB
testcase_11 AC 811 ms
48,320 KB
testcase_12 AC 823 ms
48,196 KB
testcase_13 AC 817 ms
48,300 KB
testcase_14 AC 34 ms
10,880 KB
testcase_15 AC 35 ms
11,008 KB
testcase_16 AC 34 ms
10,752 KB
testcase_17 AC 36 ms
10,880 KB
testcase_18 AC 35 ms
10,880 KB
testcase_19 AC 35 ms
10,880 KB
testcase_20 AC 36 ms
10,880 KB
testcase_21 AC 34 ms
10,752 KB
testcase_22 AC 34 ms
10,880 KB
testcase_23 AC 34 ms
10,880 KB
testcase_24 RE -
testcase_25 AC 1,069 ms
40,864 KB
testcase_26 AC 614 ms
35,168 KB
testcase_27 AC 160 ms
16,756 KB
testcase_28 RE -
testcase_29 AC 700 ms
42,988 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 651 ms
39,812 KB
testcase_38 AC 821 ms
33,404 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 1,188 ms
46,248 KB
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 32 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=map(int,input().split())
B=[tuple(map(int,input().split())) for i in range(N)]
X=list(map(int,input().split()))

B.append((0,0))
B.append((1<<28,0))

N+=2

from operator import itemgetter
B.sort(key=itemgetter(0))

LSUM=[0]
for x,w in B:
    LSUM.append(LSUM[-1]+w)

LC=[0]
for i in range(1,N):
    LC.append(LC[-1]+(B[i][0]-B[i-1][0])*LSUM[i])

RSUM=[0]
for x,w in B[::-1]:
    RSUM.append(RSUM[-1]+w)

RC=[0]
for i in range(N-1,0,-1):
    RC.append(RC[-1]+(B[i][0]-B[i-1][0])*RSUM[N-i])

LC.append(0)
RC.append(0)
import bisect

for x in X:
    t=bisect.bisect_left(B,(x,1<<30))

    print(LC[t-1]+LSUM[t]*(x-B[t-1][0])+RC[N-1-t]+RSUM[N-t]*(B[t][0]-x))
0