# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982863 | mariaclara | Meetings (IOI18_meetings) | C++17 | 5562 ms | 6748 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;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 4e5+5;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
int N = sz(H), Q = sz(L);
if(N <= 5000 and Q <= 5000) {
vector<ll> ans(Q,1e15), p(N);
vector<int> v(N);
for(int i = 0; i < N; i++) {
v[i] = H[i];
for(int j = i-1; j >= 0; j--)
v[j] = max(v[j+1], H[j]);
for(int j = i+1; j < N; j++)
v[j] = max(v[j-1], H[j]);
p[0] = v[0];
for(int j = 1; j < N; j++) p[j] = p[j-1] + v[j];
for(int j = 0; j < Q; j++)
ans[j] = min(ans[j], p[R[j]] - p[L[j]] + v[L[j]]);
}
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... |