#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
int cur[200009];
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(), q = l.size(), i, j;
for(i=0; i<q; i++){
for(j=l[i]; j<=r[i]; j++){
cur[j] += v[i];
if(cur[j] < 0)
cur[j] = 0;
if(cur[j] > c[j])
cur[j] = c[j];
}
}
vector<int> ans;
for(i=0; i<n; i++)
ans.push_back(cur[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5074 ms |
12116 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 |
170 ms |
7960 KB |
Output is correct |
3 |
Correct |
202 ms |
6840 KB |
Output is correct |
4 |
Execution timed out |
5101 ms |
13392 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1106 ms |
7792 KB |
Output is correct |
4 |
Correct |
1619 ms |
5320 KB |
Output is correct |
5 |
Execution timed out |
5052 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
6 |
Execution timed out |
5074 ms |
12116 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |