Submission #1030620

# Submission time Handle Problem Language Result Execution time Memory
1030620 2024-07-22T07:41:35 Z Mardonbekhazratov Distributing Candies (IOI21_candies) C++17
8 / 100
91 ms 12880 KB
#include "candies.h"

#include <vector>

using namespace std;

int n, q;

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) {
    n = c.size();
    q = l.size();
    vector<int>ans(n,0);
    vector<long long>sum(n+1,0);
    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++){
        if(i>0) sum[i]+=sum[i-1];
        ans[i]=min(sum[i],1LL*c[i]);
    }
    return ans;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 91 ms 8988 KB Output is correct
2 Correct 65 ms 12880 KB Output is correct
3 Correct 72 ms 12836 KB Output is correct
# 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 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -