#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define int long long
std::vector<long long> minimum_costs(std::vector<signed> H, std::vector<signed> L,
std::vector<signed> R) {
int Q = L.size();
std::vector<long long> C(Q);
auto getmax = [&](int l, int r) {
int re = 0;
for(int i = l; i < r; i++)
{
re = max(re, (int)H[i]);
}
return re;
};
for (int j = 0; j < Q; ++j) {
int best = INT_MAX;
for(int i = L[j]; i <= R[j]; i++)
{
int score = 0;
for(int k = L[j]; k <= R[j]; k++) {
if(k <= i)
score += getmax(k, i+1);
else
score += getmax(i, k+1);
}
best = min(score, best);
}
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... |