Submission #1194387

#TimeUsernameProblemLanguageResultExecution timeMemory
1194387amongus_pvpDistributing Candies (IOI21_candies)C++17
Compilation error
0 ms0 KiB
#include <vector>
#include <algorithm>

using namespace std;

vector<int> distribute_candies(vector<int>& c, vector<int>& l, vector<int>& r, vector<int>& v) {
    int n = c.size();
    int q = l.size();
    vector<int> s(n, 0);

    for (int i = 0; i < n; ++i) {
        int current = 0;
        for (int j = 0; j < q; ++j) {
            if (i >= l[j] && i <= r[j]) {
                if (v[j] > 0) {
                    current = min(c[i], current + v[j]);
                } else {
                    current = max(0, current + v[j]);
                }
            }
        }
        s[i] = current;
    }

    return s;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccwt8Gy6.o: in function `main':
grader.cpp:(.text.startup+0x2fe): undefined reference to `distribute_candies(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status