#include <vector>
#include <set>
#include <queue>
#include <algorithm>
using namespace std;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,std::vector<int> r, std::vector<int> v)
{
int n=c.size();
int q=l.size();
int mi=0;
for(auto i:v)
mi=min(mi,i);
vector<int> ans(n),dif(n+2);
if(mi>=0)
{
// dif[0]=a[0]
// dif[1]=a[1]-a[0]
for(int j=0;j<q;j++)
{
dif[l[j]]+=v[j];
dif[r[j]+1]-=v[j];
}
for(int i=0;i<n;i++)
{
if(i>0)
dif[i]+=dif[i-1];
ans[i]=min(dif[i],c[i]);
}
}
// else if(sp.size()==1)
// {
// }
else
{
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
76 ms |
8020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |