結果

問題 No.1012 荷物収集
ユーザー yamamura-k
提出日時 2020-03-20 22:23:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 389 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-15 06:39:15
合計ジャッジ時間 3,456 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

n,q = map(int,input())
V = [list(map(int,input().split())) for _ in range(n)]
w = min([p[1] for p in V])
V = list(map(lambda x:x[1]-w,V))
V = reversed(sorted(V,key=lambda x:x[1]))
X = [p[0] for p in V]
for x in map(int,input().split()):
    tmp = map(lambda y:abs(y-x),X)
    ans = sum(tmp)*w
    for i in range(n):
        if V[i][1] ==0:break
        ans += V[i][1]*tmp[i]
    print(ans)
0