#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void minimize(int& x, int y) {
if (x > y) {
x = y;
}
}
void maximize(int& x, int y) {
if (x < y) {
x = y;
}
}
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
int n = c.size();
int q = l.size();
vector<int> a(n);
for (int j = 0; j < q; j++) {
for (int i = l[j]; i <= r[j]; i++) {
a[i] += v[j];
maximize(a[i], 0);
minimize(a[i], c[i]);
}
}
return a;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
3 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5033 ms |
7224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
210 ms |
6100 KB |
Output is correct |
3 |
Correct |
207 ms |
6008 KB |
Output is correct |
4 |
Execution timed out |
5061 ms |
13252 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 |
494 ms |
6096 KB |
Output is correct |
4 |
Correct |
493 ms |
4004 KB |
Output is correct |
5 |
Execution timed out |
5030 ms |
10820 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 |
3 ms |
460 KB |
Output is correct |
6 |
Execution timed out |
5033 ms |
7224 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |