#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef pair<ll, ll> pll;
#define vc vector
#define st first
#define nd second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)a.size()
#define pub push_back
#define pob pop_back
vc<ll> distribute_candies(vc<ll> c, vc<ll> l, vc<ll> r, vc<ll> v) {
ll n = sz(c), q = sz(l);
vc<ll> a(n, 0);
for (ll i = 0; i < q; i++) {
for (ll j = l[i]; j <= r[i]; j++)
if (v[i] > 0)
a[j] = min(c[j], a[j] + v[i]);
else
a[j] = max(0, a[j] + v[i]);
}
return a;
}
# | 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... |