Submission #490843

# Submission time Handle Problem Language Result Execution time Memory
490843 2021-11-29T13:29:36 Z Karuk Distributing Candies (IOI21_candies) C++17
0 / 100
112 ms 8028 KB
#include<bits/stdc++.h>
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<int>add(n+1,0);
    vector<int>ans(n,0);
    for(int i=0;i<q;i++)
    {
        add[l[i]]+=v[i];
        add[r[i]+1]-=v[i];
    }
    for(int i=0;i<n;i++)
    {
        if(i!=0)ans[i]=ans[i-1];
        ans[i]+=add[i];
    }
    for(int i=0;i<n;i++)
    {
        if(ans[i]>c[i])ans[i]=c[i];
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 112 ms 8028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -