#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
int Q = L.size();
vector<ll> C(Q);
for (int j = 0; j < Q; ++j) {
ll best = INF;
for (int x = L[j]; x <= R[j]; x++) {
ll cost = 0;
int lmax = 0;
for (int i = x - 1; i >= L[j]; i--) {
lmax = max(lmax, H[i]);
cost += lmax;
}
int rmax = 0;
for (int i = x; i <= R[j]; i++) {
rmax = max(rmax, H[i]);
cost += rmax;
}
best = min(best, cost);
}
C[j] = best;
}
return C;
}
# | 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... |