Submission #570940

# Submission time Handle Problem Language Result Execution time Memory
570940 2022-05-31T15:41:06 Z sff_user Distributing Candies (IOI21_candies) C++17
0 / 100
114 ms 7836 KB
#include <vector>
#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<int> diff(n,0);
    for(int i = 0 ;i < q ; i++){
        diff[l[i]]+=v[i];
        if(r[i]+1<n) diff[r[i]+1]-=v[i];
    }
    for(int i = 1  ;i < n ; i++) diff[i]+=diff[i-1];
    for(int i = 0 ; i < n ; i++) diff[i]=min(diff[i],c[i]);
    return diff;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 7836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -