#include<bits/stdc++.h>
#define MAXN 1000007
using namespace std;
int n,q;
long long s,sum[MAXN];
vector<int> curr;
vector<int> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){
n=int(c.size()); q=int(l.size());
curr.resize(n);
for(int i=0;i<q;i++){
sum[l[i]]+=v[i];
sum[r[i]+1]-=v[i];
}
for(int i=0;i<n;i++){
s+=sum[i];
if(s>c[i])curr[i]=c[i];
else curr[i]=s;
}
return curr;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
81 ms |
9712 KB |
Output is correct |
2 |
Correct |
79 ms |
13660 KB |
Output is correct |
3 |
Correct |
76 ms |
13532 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 |
1 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 |
- |