Submission #691876

# Submission time Handle Problem Language Result Execution time Memory
691876 2023-01-31T20:02:34 Z Abito Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
#include <bits/stdc++.h>
#define pb push_bacl
const int N=1e5+5;
int n,k;
bool h=0,vis[N];
vector<int> adj[N];
void dfs(int node){
    vis[node]=true;
    for (auto u:adj[node]){
        if (vis[u]){
            h=1;
            break;
        }
        dfs(u);
    }
    return;
}
void init(int nn, int kk) {
    n=nn;k=kk;
    for (int i=0;i<k-1;i++) adj[i].pb(i+1);
    return;
}
int add_teleporter(int u, int v) {
    adj[u].pb(v);
    adj[v].pb(u);
    if (h) return h;
    for (int i=0;i<n;i++) vis[i]=false;
    dfs(0);
    return h;
}

Compilation message

game.cpp:7:1: error: 'vector' does not name a type
    7 | vector<int> adj[N];
      | ^~~~~~
game.cpp: In function 'void dfs(int)':
game.cpp:10:17: error: 'adj' was not declared in this scope
   10 |     for (auto u:adj[node]){
      |                 ^~~
game.cpp: In function 'void init(int, int)':
game.cpp:21:29: error: 'adj' was not declared in this scope
   21 |     for (int i=0;i<k-1;i++) adj[i].pb(i+1);
      |                             ^~~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:25:5: error: 'adj' was not declared in this scope
   25 |     adj[u].pb(v);
      |     ^~~