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;
vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R){
vector<long long> h, l, r;
long long n = H.size();
long long q = L.size();
for(long long i = 0; i < n; i++) h.push_back((long long)H[i]);
for(long long i = 0; i < q; i++) l.push_back((long long)L[i]);
for(long long i = 0; i < q; i++) r.push_back((long long)R[i]);
vector<long long> c(q);
for(long long i = 0; i < q; i++){
long long Bien = LLONG_MAX;
for(long long j = l[i]; j <= r[i]; j++){
long long Costo = h[j];
long long Mayor = h[j];
for(long long k = j - 1; k >= l[i]; k--){
Mayor = max(Mayor, h[k]);
Costo += Mayor;
}
Mayor = h[j];
for(long long k = j + 1; k <= r[i]; k++){
Mayor = max(Mayor, h[k]);
Costo += Mayor;
}
if(Costo < Bien) Bien = Costo;
}
c[i] = Bien;
}
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... |