Submission #1241254

#TimeUsernameProblemLanguageResultExecution timeMemory
1241254hssaan_arifStations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl "\n"
#define pb push_back

const int N = 1e3 + 5;

int a[N] , now;
vector<int> lis[N];

void dfs(int u , int par , int di){
    if ((di & 1) == 0){
        a[u] = now++;
    }
    for (int v : lis[u]){
        if (v != par){
            dfs(v , u , di+1);
        }
    }
    if ((di & 1) == 1){
        a[u] = now++;
    }
}

vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<int> labels(n);
    for (int i = 1 ; i < n ; i++){
        lis[u[i]].pb(v[i]);
        lis[v[i]].pb(u[i]);
    }
    dfs(1 , 1 , 0);
	for (int i = 0; i < n; i++) {
		labels[i] = a[i];
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    int n = c.size();
	if (c.back() < s){
        if (s < t){
            return c[0];
        }else{
            int pr = 0;
            for (int i = 1 ; i < n ; i++){
                if (c[i] > t){
                    break;
                }else{
                    pr++;
                }
            }
            return c[pr];
        }
    }else{
        int pr = 0;
        for (int i = 1 ; i < n ; i++){
            if (t > c[i]){
                break;
            }else{
                pr++;
            }
        }
        return c[pr];
    }
}

Compilation message (stderr)

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