結果

問題 No.1012 荷物収集
ユーザー otamay6
提出日時 2019-11-17 08:26:35
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 388 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,716 KB
最終ジャッジ日時 2024-10-14 12:37:33
合計ジャッジ時間 15,731 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

k = 0
for q in range(Q):
    while k<=N and X[q]>=x[k]:
        k+=1
    print(Sxw[N+1]-2*Sxw[k]+X[q]*(2*Sw[k]-Sw[N+1]))
0