Submission #493424

# Submission time Handle Problem Language Result Execution time Memory
493424 2021-12-11T09:36:57 Z vendx_greyback Swapping Cities (APIO20_swap) C++14
Compilation error
0 ms 0 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

const int mxn = 1e5;
int par[mxn], mx = 0;
bool isLine = true;

int get(int u){
    
    if(u == par[u])
        return u;
        
    return par[u] = get(par[u]);
    
}

void join(int u, int v){
    
    u = get(u);
    v = get(v);
    
    par[u] = v;
    
}

void init(int n, int m, int u[], int v[], int w[]){
    
    for(int i = 0; i < n; i++)
        par[i] = i;
    
    for(int i = 0; i < m; i++){
        
        if(get(u[i]) == get(v[i]))
            isLine = false;
        
        else
            join(u[i], v[i]);
            
        mx = max(mx, w[i]);
        
    }
    
}

int getMinimumFuelCapacity(int x, int y){
    return (isLine? -1: mx);
}

Compilation message

/usr/bin/ld: /tmp/ccybFEYF.o: in function `main':
grader.cpp:(.text.startup+0x1c3): undefined reference to `init(int, 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