# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819906 | Marco_Escandon | Dungeons Game (IOI21_dungeons) | C++17 | 0 ms | 0 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<bits/stdc++.h>
typedef long long ll;
using namespace std;
std::vector<int> distribute_candies(std::vector<int> cad, std::vector<int> l, std::vector<int> r, std::vector<int> v)
{
ll t[cad.size()+5]={};
ll n=cad.size();
for(int i=0; i<l.size(); i++)
{
t[l[i]]+=v[i];
t[r[i]+1]-=v[i];
}
cad[0]=min(t[0],(ll)cad[0]);
for(int i=1; i<n; i++)
{
t[i]+=t[i-1];
cad[i]=min(t[i],(ll)cad[i]);
}
return cad;
}