#include "nile.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll> calculate_costs(vector<int> w, vector<int> a, vector<int> b, vector<int> e) {
int q = e.size();
int n = w.size();
vector<vector<int>> artifacts(n, vector<int>(3));
for (int i = 0; i < n; i++) artifacts[i] = {w[i], a[i], b[i]};
sort(artifacts.begin(), artifacts.end());
vector<ll> ans;
for (int d: e) {
ll cost = 0;
int idx = 0;
for (;;) {
if (idx == n - 1) {
cost += artifacts[idx][1];
break;
} else {
if (artifacts[idx + 1][0] - artifacts[idx][0] <= d) {
cost += artifacts[idx][2] + artifacts[idx + 1][2];
idx += 2;
} else {
cost += artifacts[idx][1];
idx++;
}
}
}
ans.push_back(cost);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |