Submission #841830

# Submission time Handle Problem Language Result Execution time Memory
841830 2023-09-02T07:07:20 Z manizare Cop and Robber (BOI14_coprobber) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> 
#include "coprobber.h"

#define pb push_back 
#define F first 
#define S second 
#define all(a) a.begin(),a.end() 
#define pii pair<int,int>
#define int long long
using namespace std ;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxk=1002 , sq = 333   , lg = 20 , K = 0,   inf = 1e18+10  , mod = 1e9 + 7 ;
int cnt = 0  , dis[MAX_N] , par[MAX_N] , st[MAX_N] , en[MAX_N] , cur = 0  ;
vector <int> G[MAX_N] ;
void dfs(int v , int p = -1){
  st[v] = cnt ; cnt++;
  for(int i =0 ; i < (int)G[v].size() ; i++){
    int u = G[v][i] ; 
    if(u== p)continue ;
    dis[u] = dis[v] + 1;
    dfs(u , v) ;
  }
  en[v] = cnt ; cnt ++ ;
}

int start(int n , bool a[MAX_N][MAX_N]){
  for(int i = 0 ; i < N ; i++){
    for(int j =0 ; j < N; j++){
      if(a[i][j])G[i].pb(j) ;
    }
  } 
  dfs(0) ;
  return 0; 
}

int ch(int v , int u){
  if(st[u] >= st[v] && en[v] >= en[u]){
     return 1; 
  }
  return 0 ;
}

int nextMove(int v){
  if(dis[v]-1 == dis[cur])return cur ; 
  for(int i =0 ; i < (int)G[cur].size() ; i++){
    int u = G[cur][i] ;
    if(ch(u, v) && ch(cur , u)){
      cur = u;
      break ;
    }
  }
  return cur ;
}

/*
signed main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
  int  m ; 
  cin >> n >>m ;
  for(int i =1;i <= m ; i++){
    int v , u ;
    cin >> v >> u ;
    c[v][u] = c[u][v] = 1; 
  }
  int cc = start(n , c) ;
  cout << cc << endl ;cout.flush(); 
  cout.flush() ;
  if(cc == -1)return 0;
  while(1){
    int t ;
    cin >> t;
    if(t == cc)return 0 ; 
    cc = nextMove(t) ;
    cout << cc << endl ;cout.flush() ;

  }
}

*/

Compilation message

coprobber.cpp: In function 'long long int start(long long int, bool (*)[500])':
coprobber.cpp:28:23: error: 'N' was not declared in this scope
   28 |   for(int i = 0 ; i < N ; i++){
      |                       ^