Submission #516597

# Submission time Handle Problem Language Result Execution time Memory
516597 2022-01-21T14:49:46 Z marat0210 Distributing Candies (IOI21_candies) C++17
Compilation error
0 ms 0 KB
#include <candies.h>
#include <bits/stdc++.h>

using namespace std;

vector <long long> distribute_candies(vector <long long> c, vector <long long> l, vector <long long> r, vector <long long> v)
{
    long long n = c.size();
    vector <long long> res(n);
    long long q = l.size();
    for (int i = 0; i < q; ++i) {
        long long left = l[i], right = r[i], add = v[i];
        for (int j = left; j <= right; ++j) {
            if (add < 0) {
                res[j] = max(0ll, res[j] + add);
            }
            else {
                res[j] = min(c[j], res[j] + add);
            }
        }
    }
    return res;
}

Compilation message

/usr/bin/ld: /tmp/cczgP8cq.o: in function `main':
grader.cpp:(.text.startup+0x30e): 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