# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1067851 | Muhammad_Aneeq | Meetings (IOI18_meetings) | C++17 | 483 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;
long long val[n+10][n+10]={};
for (int i=0;i<n;i++)
{
int mx=H[i];
val[i][i]=mx;
for (int j=i-1;j>=0;j--)
{
mx=max(mx,H[j]);
val[i][j]=mx;
}
mx=H[i];
for (int j=i+1;j<n;j++)
{
mx=max(mx,H[j]);
val[i][j]=mx;
}
}
long long pre[n+10][n+10]={};
for (int i=0;i<n;i++)
for (int j=1;j<=n;j++)
pre[i][j]=pre[i][j-1]+val[i][j-1];
for (int i=0;i<L.size();i++)
{
long long a=1e15;
for (int j=L[i];j<=R[i];j++)
{
a=min(a,pre[j][R[i]+1]-pre[j][L[i]]);
}
ans.push_back(a);
}
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... |