Submission #1053196

# Submission time Handle Problem Language Result Execution time Memory
1053196 2024-08-11T09:38:04 Z MercubytheFirst Distributing Candies (IOI21_candies) C++17
0 / 100
74 ms 13672 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

std::vector<signed> distribute_candies(std::vector<signed> c, std::vector<signed> l,
                                    std::vector<signed> r, std::vector<signed> v) {
    ll n = c.size();
    vector<ll> diff(n + 1);
    vector<signed> ans(n);
    for(ll i = 0; i < n; ++i) {
        diff[i] = v[i] - (i > 0 ? v[i - 1] : 0);
    }
    ll Q = l.size();
    for(ll i = 0; i < Q; ++i) {
        diff[l[i]] += v[i];
        diff[r[i] + 1] -= v[i];
    }
    ll sum = 0;
    for(ll i = 0; i < n; ++i) {
        sum += diff[i];
        ans[i] = max(sum, (ll)c[i]);
    }
    return ans;
}
# 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 74 ms 13672 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 -
# 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 -