#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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<ll> ps(N+1);
for (int q = 0; q < Q; q++)
{
ps[l[q]] += v[q];
ps[r[q]+1] -= v[q];
}
vector<int> s(N);
ll sum = 0;
for (int i = 0; i < N; i++)
{
sum += ps[i];
s[i] = min((ll)c[i], sum);
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
9044 KB |
Output is correct |
2 |
Correct |
65 ms |
12884 KB |
Output is correct |
3 |
Correct |
66 ms |
12780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |