# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800787 | biank | Meetings (IOI18_meetings) | C++14 | 5542 ms | 756828 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;
#define SIZE(x) (int)x.size()
#define ll long long
const ll INF = 1e16;
vector<ll> minimum_costs(vector<int> H, vector<int> L,
vector<int> R) {
int Q = SIZE(L);
int N = SIZE(H);
vector <vector <int>> c(N, vector <int> (N, INF));
vector <vector <ll>> p(N, vector <ll> (N+1));
for (int i=0; i<N; i++) {
c[i][i] = H[i];
p[i][0] = 0;
for (int j=i-1; j>=0; j--) {
c[i][j] = max(c[i][j+1], H[j]);
}
for (int j=i+1; j<N; j++) {
c[i][j] = max(c[i][j-1], H[j]);
}
for (int j=0; j<N; j++) {
p[i][j+1] = p[i][j] + c[i][j];
//cerr << c[i][j] << ' ';
}
//cerr << endl;
}
//cerr << "============" << endl;
for (int i=0; i<N; i++) {
for (int j=0; j<N+1; j++) {
//cerr << p[i][j] << ' ';
}
//cerr << endl;
}
vector <ll> s(Q);
for (int i=0; i<Q; i++) {
s[i] = INF;
for (int j=0; j<N; j++) {
s[i] = min(s[i], p[j][R[i]+1] - p[j][L[i]]);
}
}
return s;
}
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... |