Submission #1010156

# Submission time Handle Problem Language Result Execution time Memory
1010156 2024-06-28T11:54:12 Z mindiyak Distributing Candies (IOI21_candies) C++17
8 / 100
69 ms 12884 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();
    vector<long long> prefix_sum(n+1);
    int q = L.size();
    for(int i=0; i<q; i++) {
        prefix_sum[L[i]] += V[i];
        prefix_sum[R[i]+1] -= V[i];
    }
    vector<int> ans(n);
    long long cumulative = 0;
    for(int i=0; i<n; i++) {
        cumulative += prefix_sum[i];
        ans[i] = min((long long)C[i], cumulative);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 64 ms 8952 KB Output is correct
2 Correct 69 ms 12884 KB Output is correct
3 Correct 64 ms 12880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -