Submission #435163

# Submission time Handle Problem Language Result Execution time Memory
435163 2021-06-23T04:38:21 Z MinhQNgo Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
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();
    int q = l.size();
    std::vector<int> s(n, 0);
    for (int time = 0; time < q; time++) {
        int L = l[time], R = r[time], V = v[time];
        for (int i = L; i <= R; i++) {
            if (V > 0) s[i] = min(c[i], s[i] + V);
            else s[i] = max(0, s[i] + V);
        }
    }
    return s;
}

Compilation message

candies.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
      |      ^~~~~~
candies.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,