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 <vector>
#include<bits/stdc++.h>
using namespace std;
using ll = int;
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();
ll q = l.size();
vector<ll> a(n+1,0);
for(ll i = 0;i<q;i++){
a[l[i]] += v[i];
a[r[i]+1] -= v[i];
}
for(ll i = 0;i<n;i++) a[i+1] += a[i];
vector<ll> out(n,0);
for(ll i = 0;i<n;i++) out[i] = min(c[i],a[i]);
return out;
}
# | 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... |