#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
vi distribute_candies(vi c, vi l, vi r, vi v){
int i, j;
int q = l.size();
int n = c.size();
vi val(n, 0);
for(i=0;i<n;i++){
for(j=0;j<q;j++){
if(i>=l[j] && i<=r[j]){
if(v[j]<0) val[i] = max(0, val[i]+v[j]);
else val[i] = min(c[i], val[i]+v[j]);
}
}
}
return val;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
5 |
Correct |
13 ms |
312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5089 ms |
12076 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
308 KB |
Output is correct |
2 |
Correct |
2608 ms |
8036 KB |
Output is correct |
3 |
Correct |
1132 ms |
6024 KB |
Output is correct |
4 |
Execution timed out |
5083 ms |
13264 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
2590 ms |
7660 KB |
Output is correct |
4 |
Correct |
1564 ms |
4012 KB |
Output is correct |
5 |
Execution timed out |
5019 ms |
10932 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
5 |
Correct |
13 ms |
312 KB |
Output is correct |
6 |
Execution timed out |
5089 ms |
12076 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |