Submission #438997

# Submission time Handle Problem Language Result Execution time Memory
438997 2021-06-29T03:33:10 Z jlozano254 Distributing Candies (IOI21_candies) C++17
8 / 100
125 ms 13244 KB
#include "candies.h"

#include <vector>

typedef long long ll;

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    int n = c.size();
    std::vector<int> s;
    std::vector<ll> dp(n + 1);

    for (int i = 0; i < (int) v.size(); ++i) {
        dp[l[i]] += v[i];
        dp[r[i] + 1] -= v[i];
    }

    for (int i = 1; i < (int) n; ++i) dp[i] += dp[i - 1];

    for (int i = 0; i < (int) n; ++i) s.push_back(std::min(dp[i], (ll) c[i]));

    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 125 ms 9164 KB Output is correct
2 Correct 124 ms 13244 KB Output is correct
3 Correct 118 ms 13068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -