#include "candies.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
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> s(n,0);
for(int i=0;i<q;i++){
for(int j=l[i];j<=r[i];j++){
if(v[i]>0){
s[j]=min((ll)c[j],s[j]+v[i]);
}else{
s[j]=max((ll)0,s[j]-v[i]);
}
}
}
vector<int>ans;
for(int i=0;i<n;i++){
ans.push_back((int)min((ll)c[i],s[i]));
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
Execution timed out |
5061 ms |
8052 KB |
Time limit exceeded |
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 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |