# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067863 | Muhammad_Aneeq | Meetings (IOI18_meetings) | C++17 | 5569 ms | 6572 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 <vector>
using namespace std;
vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R)
{
int n=H.size();
vector<long long>ans(L.size(),1e15);
int val[n]={};
long long pre[n+1]={};
for (int i=0;i<n;i++)
{
int mx=H[i];
val[i]=mx;
for (int j=i-1;j>=0;j--)
{
mx=max(mx,H[j]);
val[j]=mx;
}
mx=H[i];
for (int j=i+1;j<n;j++)
{
mx=max(mx,H[j]);
val[j]=mx;
}
for (int j=1;j<=n;j++)
pre[j]=pre[j-1]+val[j-1];
for (int j=0;j<L.size();j++)
{
if (i>=L[j]&&i<=R[j])
ans[j]=min(ans[j],pre[R[j]+1]-pre[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... |