#include "candies.h"
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<int>distribute_candies(vector<int>_c, vector<int>l, vector<int>r, vector<int>v) {
int n=_c.size(), q=l.size();
vector<int>ans(n);
rep(i, n) {
ll c=_c[i], x=0;
rep(j, q) if(l[j]<=i && i<=r[j]) {
x+=v[j];
x=min(x, c);
x=max(x, 0ll);
}
ans[i]=x;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
452 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5077 ms |
7416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1436 ms |
8020 KB |
Output is correct |
3 |
Correct |
418 ms |
5952 KB |
Output is correct |
4 |
Execution timed out |
5087 ms |
13392 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
665 ms |
5100 KB |
Output is correct |
4 |
Correct |
610 ms |
3924 KB |
Output is correct |
5 |
Execution timed out |
5040 ms |
10832 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
452 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
6 |
Execution timed out |
5077 ms |
7416 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |