#include "candies.h"
#include "bits/stdc++.h"
#define pb push_back
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
vector<int> distribute_candies(vector<int> c,vector<int> l,
vector<int> r, vector<int> v) {
int n=sz(c),q=sz(l);
vector<int> cur(n,0);
for(int i=0;i<q;i++){
cur[l[i]]+=v[i];
if(r[i]+1<n) cur[r[i]+1]-=v[i];
}
for(int i=1;i<n;i++) cur[i]+=cur[i-1];
for(int i=0;i<n;i++) cur[i]=min(cur[i],c[i]);
return cur;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
10068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |