# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067857 | Muhammad_Aneeq | Meetings (IOI18_meetings) | C++17 | 1510 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.
#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);
vector<int>qu[n]={};
for (int i=0;i<L.size();i++)
{
for (int j=L[i];j<=R[i];j++)
qu[j].push_back(i);
}
int val[n]={};
long long pre[n+1]={};
for (int i=0;i<n;i++)
{
if (qu[i].size()==0)
continue;
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 (auto j:qu[i])
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... |