Submission #309052

#TimeUsernameProblemLanguageResultExecution timeMemory
309052mohamedsobhi777Game (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "game.h"

const int MX = 1600 + 7 ; 
using namespace std ; 
int gn ; 
bool del[MX][MX] ;
int viz[MX] ;
int Cnt = 0 ; 
set<int> adz[N] ; 

void initialize(int x) {
        gn = x; 
        for(int i = 0 ;i < x ; ++ i){
                for(int j = 0 ;j < x ; ++ j){
                        if(i != j){
                                adz[i].insert(j) ; 
                        }
                }
        }
}

void dfz(int x , int p){

        if(viz[x]++)
                return ; 

        for(auto u : adz[x]){
                if(u == p)
                        continue ; 
                dfz(u , x) ;
        }
}

int count(){
        Cnt = 0 ; 
        memset(viz , 0 , sizeof viz) ; 
        for(int i = 0 ; i < gn; ++ i){
                if(!viz[i]){
                        ++ Cnt ; 
                }
                dfz(i , i) ; 
        }
        return Cnt ; 
}

int hasEdge(int u, int v) {
        adz[u].erase(v) ; 
        adz[v].erase(u) ; 
        if(count() == 1){
                return 0 ; 
        }
        adz[u].insert(v) ; 
        adz[v].insert(u) ; 
        return 1 ; 
}

Compilation message (stderr)

game.cpp:10:14: error: 'N' was not declared in this scope
   10 | set<int> adz[N] ;
      |              ^
game.cpp: In function 'void initialize(int)':
game.cpp:17:33: error: 'adz' was not declared in this scope
   17 |                                 adz[i].insert(j) ;
      |                                 ^~~
game.cpp: In function 'void dfz(int, int)':
game.cpp:28:22: error: 'adz' was not declared in this scope
   28 |         for(auto u : adz[x]){
      |                      ^~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:48:9: error: 'adz' was not declared in this scope
   48 |         adz[u].erase(v) ;
      |         ^~~