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) {
int n=H.size(),cost[n][n];
for(int i=0;i<n;i++){
cost[i][i]=H[i];
for(int j=i+1;j<n;j++)cost[i][j]=max(cost[i][j-1],H[j]);
}
for(int i=n-1;i>=0;i--){
for(int j=i-1;j>=0;j--)cost[i][j]=max(cost[i][j+1],H[j]);
}
int Q = L.size();
vector<long long> C(Q);
long long ans = 3000000000007,temp=0;
for (int j = 0; j < Q; ++j) {
ans = 3000000000007;
for(int i=L[j];i<=R[j];i++){
temp=0;
for(int k=L[j];k<=R[j];k++){
temp+=cost[k][i];
}
ans=min(ans,temp);
}
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... |