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>
#define vi vector<int>
#define vb vector<bool>
#define vpii vector<pair<int,int>>
#define pb push_back
#define vvi vector<vector<int>>
#define ll long long int
#define f0r(i,n) for(int i = 0; i<n; i++)
#define vout(v) for(auto u : v)cout<<u<<' '; cout<<'\n';
#define pii pair<int,int>
using namespace std;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
int q = L.size();
std::vector<long long> ans(q);
vi v = H;
f0r(i, q){
int l = L[i];
int r = R[i];
ll cur = 4e18;
for(int j = l; j <= r; j++){
ll s = 0;
int runmx = v[j];
for(int k = j; k >= l; k--){
runmx = max(runmx, v[k]);
s += runmx;
}
runmx = v[j];
for(int k = j+1; k<=r; k++){
runmx = max(runmx, v[k]);
s += runmx;
}
cur = min(cur,s);
//cout<<s<<'\n';
}
ans[i] = cur;
}
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... |