#include "candies.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7, N = 2e5 + 7;
int c[N], n;
int a[N];
vi distribute_candies(vi _c, vi _l, vi _r, vi _v) {
n = SZ(_c);
for(int i = 0; i < n; i++)
c[i] = _c[i];
int q = SZ(_l);
for(int i = 0; i < q; i++) {
int l = _l[i], r = _r[i], v = _v[i];
for(int j = l; j <= r; j++) {
a[j] += v;
a[j] = max(a[j], 0);
a[j] = min(a[j], c[j]);
}
}
vi ans(n);
for(int i = 0; i < n; i++)
ans[i] = a[i];
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5066 ms |
8040 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
177 ms |
7968 KB |
Output is correct |
3 |
Correct |
167 ms |
7584 KB |
Output is correct |
4 |
Execution timed out |
5041 ms |
14048 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 |
312 KB |
Output is correct |
3 |
Correct |
410 ms |
5552 KB |
Output is correct |
4 |
Correct |
405 ms |
4484 KB |
Output is correct |
5 |
Execution timed out |
5065 ms |
8804 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Execution timed out |
5066 ms |
8040 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |