Submission #1109730

# Submission time Handle Problem Language Result Execution time Memory
1109730 2024-11-07T12:36:35 Z Trisanu_Das Tree (IOI24_tree) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
const int MAX_NODES = 300005;
 
int n, child_count[MAX_NODES], leaf_count;
vector<int> parent, weight;
 
void init(const vector<int>& _parent, const vector<int>& _weight) {
    parent = _parent;
    weight = _weight;
    n = parent.size();
    fill(child_count, child_count + n, 0);
    leaf_count = 0;
    for (int i = 1; i < n; i++) child_count[parent[i]]++;
    for (int i = 0; i < n; i++) if (child_count[i] == 0) leaf_count++;
}
 
ll query(int left, int right) {
    return leaf_count * (ll)left + max(0LL, leaf_count * (ll)left - right);
}

Compilation message

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