Submission #715047

#TimeUsernameProblemLanguageResultExecution timeMemory
715047Ahmed57Game (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")

using namespace std;
int pr[1501],gs[1501];
int ed[1501][1501];
int findleader(int x){
    if(pr[x]==x){
        return x;
    }
    return pr[x] = findleader(pr[x]);
}
int N;
void initialize(int n){
    N = n;
    for(int i = 0;i<=n;i++)pr[i] = i,gs[i] = 1;
}
int hasEdge(int a,int b){
    a = findleader(a), b = findleader(b);
    if(gs[a]<gs[b])swap(a,b);
    if(gs[a]*gs[b]-1>ed[a][b]){
        ed[a][b]++;
        ed[b][a]++;
        return 0;
    }
    gs[a]+=gs[b];
    pr[b]=a;
    for(int i = 1;i<=m;i++){
        ed[a][i]+=ed[b][i];
        ed[i][a]+=ed[i][b];
    }
    return 1;
}
int main(){
    intilize(4);
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:28:22: error: 'm' was not declared in this scope
   28 |     for(int i = 1;i<=m;i++){
      |                      ^
game.cpp: In function 'int main()':
game.cpp:35:5: error: 'intilize' was not declared in this scope; did you mean 'initialize'?
   35 |     intilize(4);
      |     ^~~~~~~~
      |     initialize