#include <bits/stdc++.h>
#include "candies.h"
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define pb push_back
#define F first
#define pii pair<int,int>
#define all(a) a.begin(),a.end()
#define S second
#define sz(a) (int)a.size()
#define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++)
#define per(i , a , b) for(int i = (a) ; i >= (b) ; i--)
#define ld double
#define ll long long
using namespace std ;
const int maxn = 2e6 + 10 , inf = 1e9+ 10 , mod = 998244353;
int a[maxn] ;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,std::vector<int> r, std::vector<int> v){
rep(i , 0 ,sz(l)-1){
rep(j , l[i] , r[i]){
if(v[i] > 0){
a[j] = min(c[j] , v[i]+a[j]);
}else{
a[j] = max(0 , v[i] + a[j]) ;
}
}
}
vector <int> ans ;
rep(i ,0 ,sz(c)-1)ans.pb(a[i]) ;
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... |