#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
ll n = c.size();
ll q = l.size();
vector<int> ans(n);
vector<ll> change(n + 1);
for (ll i = 0; i < q; i++) {
change[l[i]] += v[i];
change[r[i] +1] -= v[i];
}
ll akt = 0;
for (ll i = 0; i < n; i++) {
akt += change[i];
ans[i] = min((ll) c[i], akt);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
8816 KB |
Output is correct |
2 |
Correct |
76 ms |
11724 KB |
Output is correct |
3 |
Correct |
76 ms |
11724 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 |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |