Submission #1053203

# Submission time Handle Problem Language Result Execution time Memory
1053203 2024-08-11T09:43:18 Z MercubytheFirst Distributing Candies (IOI21_candies) C++17
8 / 100
55 ms 13032 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);
    ll Q = l.size();
    assert(l.size() == r.size() and v.size() == 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) {
        // cout << diff[i] << ' ';
        sum += diff[i];
        ans[i] = min(sum, (ll)c[i]);
    }
    // cout << endl;
    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 54 ms 8952 KB Output is correct
2 Correct 52 ms 13032 KB Output is correct
3 Correct 55 ms 12784 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 344 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 -