# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068297 | Ignut | Meetings (IOI18_meetings) | C++17 | 497 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.
// Ignut
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18 + 123;
vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
int N = H.size();
ll goLeft[N][N] = {};
ll goRight[N][N] = {};
for (int i = 0; i < N; i ++) {
ll mx = H[i];
ll sum = 0;
for (int j = i; j >= 0; j --) {
mx = max(mx, 1ll * H[j]);
sum += mx;
goLeft[i][j] = sum;
}
mx = H[i];
sum = 0;
for (int j = i; j < N; j ++) {
mx = max(mx, 1ll * H[j]);
sum += mx;
goRight[i][j] = sum;
}
}
// for (int i = 0; i < N; i ++) {
// for (int j = 0; j < N; j ++) {
// cout << goLeft[i][j] << ' ';
// }
// cout << '\n';
// }
// for (int i = 0; i < N; i ++) {
// for (int j = 0; j < N; j ++) {
// cout << goRight[i][j] << ' ';
// }
// cout << '\n';
// }
vector<ll> res;
for (int i = 0; i < L.size(); i ++) {
ll ans = INF;
for (int s = L[i]; s <= R[i]; s ++)
ans = min(ans, goLeft[s][L[i]] + goRight[s][R[i]] - H[s]);
res.push_back(ans);
}
return res;
}
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... |