Submission #838761

# Submission time Handle Problem Language Result Execution time Memory
838761 2023-08-27T17:24:24 Z ErJ Distributing Candies (IOI21_candies) C++17
8 / 100
79 ms 11724 KB
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;
typedef long long ll;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    ll n = c.size();
    ll q = l.size();
    vector<int> ans(n);
    vector<ll> change(n + 1);
    for (ll i = 0; i < q; i++) {
        change[l[i]] += v[i];
        change[r[i] +1] -= v[i];
    }
    ll akt = 0;
    for (ll i = 0; i < n; i++) {
        akt += change[i];
        ans[i] = min((ll) c[i], akt);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 8816 KB Output is correct
2 Correct 76 ms 11724 KB Output is correct
3 Correct 76 ms 11724 KB Output is correct
# 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 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -