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 "candies.h"
#include<bits/stdc++.h>
#define vi vector<int>
using namespace std;
#define ll long long
#define vll vector<ll>
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v) {
int n = c.size();
vi ans(n);
int m = r.size();
vll his(n+1);
for(int i = 0; i < m; i++){
his[l[i]]+=v[i];
his[r[i]+1]-=v[i];
}
ll sum = 0;
for(int i = 0; i < n; i++){
sum+=his[i];
ans[i] = min((ll)c[i],sum);
}
return ans;
}
# | 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... |