# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
790681 | peteza | Meetings (IOI18_meetings) | C++14 | 5554 ms | 201600 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 <iostream>
int dp[5005][5005];
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> C(Q);
//std::cout << "HELLO";
for(int i=0;i<H.size();i++) {
int cm = H[i];
for(int j=i;j>=0;j--) {
cm = std::max(cm, H[j]);
dp[i][j] = cm;
}
cm = H[i];
for(int j=i;j<H.size();j++) {
cm = std::max(cm, H[j]);
dp[i][j] = cm;
}
}
for (int j = 0; j < Q; ++j) {
long long curans = __LONG_LONG_MAX__;
for(int k=L[j];k<=R[j];k++) {
long long csum = 0;
for(int i=L[j];i<=R[j];i++)
csum += dp[i][k];
curans = std::min(curans, csum);
}
C[j] = curans;
}
return C;
}
/*
4 2
2 4 3 5
0 2
1 3
*/
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... |