Submission #500215

# Submission time Handle Problem Language Result Execution time Memory
500215 2021-12-30T13:15:01 Z sazid_alam 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 int> distribute_candies(vector<long long int> c, vector<long long int> l,
                                    vector<long long int> r, vector<long long int> v) {
    int n = c.size();
    vector<long long int> sum(n + 1, 0);

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

    for(int i = 1; i < n; i++) sum[i] += sum[i - 1];
    for(int i = 0; i < n; i++) c[i] = min(c[i], sum[i]);

    return c;
}

Compilation message

/usr/bin/ld: /tmp/ccZwBxwu.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