# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601580 | jack715 | 모임들 (IOI18_meetings) | C++14 | 582 ms | 786432 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>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L,
std::vector<int> R) {
int n = H.size(), mx;
ll left[n][n], right[n][n];
ll now;
for (int i = n-1; i >= 0; i--) {
now = 0, mx = 0;
for (int j = i; j >= 0; j--) {
mx = max(mx, H[j]);
now += mx;
right[j][i] = now;
}
}
for (int i = 0; i < n; i++) {
now = 0, mx = 0;
for (int j = i; j < n; j++) {
mx = max(mx, H[j]);
now += mx;
left[i][j] = now;
}
}
vector<long long> ans(L.size(), 1e18);
for (int q = 0; q < L.size(); q++) {
for (int i = L[q]; i <= R[q]; i++) {
// cout << i << ' ' << left[L[q]][i]+right[i][R[q]]-H[i] << '\n';
ans[q] = min(ans[q], right[L[q]][i]+left[i][R[q]]-H[i]);
}
// cout << "===\n";
}
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... |