結果
| 問題 |
No.1012 荷物収集
|
| コンテスト | |
| ユーザー |
otamay6
|
| 提出日時 | 2019-11-05 23:35:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 697 bytes |
| コンパイル時間 | 1,758 ms |
| コンパイル使用メモリ | 174,068 KB |
| 実行使用メモリ | 15,264 KB |
| 最終ジャッジ日時 | 2024-10-14 12:35:12 |
| 合計ジャッジ時間 | 5,876 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | TLE * 1 -- * 40 |
ソースコード
#include<bits/stdc++.h>
#include<unistd.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
vector<ll> gutyoku(ll N,ll Q,vector<pair<ll,ll>> A,vector<ll> X){
vector<ll> res;
REP(q,Q){
ll tmp=0;
REP(i,N) tmp+=abs(A[i].first-X[q])*A[i].second;
res.push_back(tmp);
}
return res;
}
int main(){
ll N,Q;cin>>N>>Q;
vector<pair<ll,ll>> A(N);
REP(i,N) cin>>A[i].first>>A[i].second;
vector<ll> X(Q);
REP(i,Q) cin>>X[i];
vector<ll> ans=gutyoku(N,Q,A,X);
REP(i,Q){
cout<<ans[i]<<endl;
}
}
otamay6