# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115424 | dsjong | Meetings (IOI18_meetings) | C++14 | 695 ms | 398896 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;
long long rsq[5005][5005];
vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R){
vector<long long>ret;
int N=H.size();
memset(rsq,0,sizeof rsq);
for(int i=0;i<N;i++){
int maxi=H[i];
rsq[i][i]=H[i];
for(int j=i-1;j>=0;j--){
maxi=max(maxi,H[j]);
rsq[i][j]=rsq[i][j+1]+maxi;
}
maxi=H[i];
for(int j=i+1;j<N;j++){
maxi=max(maxi,H[j]);
rsq[i][j]=rsq[i][j-1]+maxi;
}
}
for(int q=0;q<L.size();q++){
int l=L[q],r=R[q];
long long res=LONG_LONG_MAX;
for(int i=l;i<=r;i++){
res=min(res,rsq[i][l]+rsq[i][r]-H[i]);
}
ret.push_back(res);
}
return ret;
}
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... |