Submission #1084074

#TimeUsernameProblemLanguageResultExecution timeMemory
1084074KasymKGame (IOI14_game)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 2e3+5;
int num_comp, cnt;
bool start = false;
int rep[N], sz[N];

int find(int x){
    if(rep[x] == x)
        return x;
    return rep[x] = find(rep[x]);
}

void merge(int a, int b){
    int x = find(a), y = find(b);
    assert(x != y); // ikisi bir componentda dal
    if(sz[y] > sz[x])
        swap(x, y);
    sz[x] += sz[y];
    rep[y] = x;
}

void initialize(int n){
    num_comp = n;
    for(int i = 1; i <= n; ++i)
        rep[i] = i, sz[i] = 1;
    return;
}

int has_edge(int u, int v){
    u++, v++;
    if(find(u) == find(v))
        return 1; // componentlan sany uytganok
    // diymek ikisi bir componentda dal
    if(start)
        return 0;
    merge(u, v); // componentlardan bir san ayyrylyar
    num_comp--;
    if(num_comp == 2)
        start = true;
}

Compilation message (stderr)

game.cpp: In function 'int has_edge(int, int)':
game.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
/usr/bin/ld: /tmp/ccyMapjX.o: in function `main':
grader.cpp:(.text.startup+0x94): undefined reference to `hasEdge(int, int)'
collect2: error: ld returned 1 exit status