# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292308 | kimbj0709 | Meetings (IOI18_meetings) | C++14 | 4882 ms | 504824 KiB |
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;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
long long int arr[H.size()+5][H.size()+5];
vector<long long> ans(L.size());
long long int n = H.size();
for(int i=0;i<n;i++){
long long int currsum = 0;
int currmax = 0;
for(int j=i;j>=0;j--){
currmax = max(currmax,H[j]);
currsum += currmax;
arr[i][j] = currsum;
}
currsum = 0,currmax = 0;
for(int j=i;j<n;j++){
currmax = max(currmax,H[j]);
currsum += currmax;
arr[i][j] = currsum;
}
}
for(int i=0;i<L.size();i++){
long long int currmin = LLONG_MAX;
for(int j=L[i];j<=R[i];j++){
//cout << arr[j][L[i]]+arr[j][R[i]]-arr[j][j] << endl;
currmin = min(currmin,arr[j][L[i]]+arr[j][R[i]]-arr[j][j]);
}
ans[i] = currmin;
}
return ans;
}
Compilation message (stderr)
# | 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... |