#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
int n, q;
vi distribute_candies(vi c, vi l, vi r, vi v) {
n = (int)c.size();
q = (int)l.size();
vi ans(n);
for(int i = 0; i < q; ++i) {
for(int a = l[i]; a <= r[i]; a++) {
ans[a] += v[i];
ans[a] = max(ans[a], 0);
ans[a] = min(ans[a], c[a]);
}
}
return ans;
}
//int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
//vi w = distribute_candies({10, 15, 13}, {0, 0}, {2, 1}, {20, -11});
//for(int x : w) {
//cout << x << " ";
//}
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
6 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5050 ms |
7220 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
246 ms |
4964 KB |
Output is correct |
3 |
Correct |
243 ms |
3820 KB |
Output is correct |
4 |
Execution timed out |
5045 ms |
7236 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
648 ms |
5012 KB |
Output is correct |
4 |
Correct |
710 ms |
2740 KB |
Output is correct |
5 |
Execution timed out |
5033 ms |
7344 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
6 ms |
332 KB |
Output is correct |
6 |
Execution timed out |
5050 ms |
7220 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |