This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
int Q,N;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) {
Q = L.size(); N = H.size();
vector<long long> C(Q);
for (int q = 0; q < Q; q++) {
int minCost = -1;
for (int x = L[q]; x <= R[q]; x++) {
int cost = 0;
int high = 0;
for (int j = x; j >= L[q]; j--) {
high = max(high,H[j]);
cost += high;
}
high = H[x];
for (int j = x+1; j <= R[q]; j++) {
high = max(high,H[j]);
// cout << high << "\n";
cost += high;
}
// cout << x << " " << cost << "\n";
minCost = (minCost == -1 ? cost : min(cost,minCost));
}
C[q] = minCost;
}
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... |