Submission #1292793

#TimeUsernameProblemLanguageResultExecution timeMemory
1292793lucasdmyStations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1010;
vector<int>graph[MAXN], labels, sub_size(MAXN), inv(MAXN);
int c=0;
void dfs(int x, int p){
    labels[x]=c;
    inv[c]=x;
    c++;
    sub_size[x]=0;
    for(int k=0;k<graph[x].size();k++){
        if(graph[x][k]!=p){
            dfs(graph[x][k], x);
            sub_size[x]+=1+sub_size[graph[x][k]];
        }
    }
}
vector<int>lable(int n, int m, vector<int>a, vector<int>b){
    for(int k=0;k<n;k++){
        graph[k].clear();
    }
    labels.resize(n);
    for(int k=0;k<n-1;k++){
        graph[a[k]].push_back(b[k]);
        graph[b[k]].push_back(a[k]);
    }
    c=0;
    dfs(0, 0);
    return labels;
}
int find_next_station(int at, int end, vector<int>adj){
    if(end<at or at+sub_size[inv[at]]<end){
        return adj[0];
    }
    for(int k=adj.size()-1;k>0;k--){
        if(end>=adj[k]){
            return adj[k];
        }
    }
    return INT_MAX;
}

Compilation message (stderr)

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