#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
int n = W.size();
int q = E.size();
vector<ll> result(q);
ll total_sum = 0;
for (int i = 0; i < n; i++) {
total_sum += A[i];
}
for (int i = 0; i < q; i++) {
ll D = E[i];
ll current_sum = total_sum;
for (int j = 0; j < n - 1; j++) {
if (1 <= D) {
current_sum += (B[j] - A[j]);
}
}
result[i] = current_sum;
}
return result;
}
int main() {
int n, q;
cin >> n >> q;
vector<int> W(n), A(n), B(n), E(q);
for(int i = 0; i < n; i++) {
W[i] = i + 1;
cin >> A[i] >> B[i];
}
for(int i = 0; i < q; i++) {
cin >> E[i];
}
vector<ll> result = calculate_costs(W, A, B, E);
for(ll x : result) {
cout << x << " ";
}
cout << endl;
return 0;
}
Compilation message
/usr/bin/ld: /tmp/ccgsO48h.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccVsC0mh.o:nile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status