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;
#define endl "\n"
// #define int long long
typedef long long ll ;
const ll ooo = 1e18 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
const int N = 10000010 ;
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 ans = ooo;
int l = L[j] , r = R[j];
for(int x = l ; x <= r ; ++x){
ll mx = H[x] , calc = H[x] ;
for(int k = x - 1 ; k >= l; k--){
mx = max(mx , (ll)H[k]);
calc += mx ;
}
for(int k = x + 1 ; k <= r; k++){
mx = max(mx , (ll)H[k]);
calc += mx ;
}
ans = min(ans , calc);
}
C[j] = ans;
}
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... |