#include "candies.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
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();
std::vector<int> s(n);
int q = l.size();
for (int i = 0; i < n; ++i)
{
int ans = 0;
for (int j = 0; j < q; ++j)
{
if (l[j] > i || r[j] < i)
continue;
ans += v[j];
if (ans < 0)
ans = 0;
if (ans > c[i])
ans = c[i];
}
s[i] = ans;
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
436 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
8 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5032 ms |
12112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1616 ms |
8172 KB |
Output is correct |
3 |
Correct |
539 ms |
6024 KB |
Output is correct |
4 |
Execution timed out |
5066 ms |
13420 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
658 ms |
7792 KB |
Output is correct |
4 |
Correct |
649 ms |
4028 KB |
Output is correct |
5 |
Execution timed out |
5041 ms |
10836 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
436 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
8 ms |
500 KB |
Output is correct |
6 |
Execution timed out |
5032 ms |
12112 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |