#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> distribute_candies(vector<int> C, vector<int> L, vector<int> R, vector<int> V) {
int Q = (int)L.size(), N = (int)C.size();
vector<int> ans0(N);
vector<long long> ans(N);
for(int i = 0; i < Q; ++i) {
ans[L[i]] += V[i];
if(R[i] + 1 < N) ans[R[i] + 1] -= V[i];
}
for(int i = 1; i < N; ++i) {
ans[i] += ans[i - 1];
}
for(int i = 0; i < N; ++i) {
ans[i] = min(ans[i], (long long)C[i]);
ans0[i] = (int)ans[i];
}
return ans0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
11360 KB |
Output is correct |
2 |
Correct |
78 ms |
12884 KB |
Output is correct |
3 |
Correct |
78 ms |
12760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |