Submission #691873

# Submission time Handle Problem Language Result Execution time Memory
691873 2023-01-31T19:59:43 Z Abito Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "game.h"
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=nm;kk;
    return;
}
int add_teleporter(int u, int v) {
    adj[u].pb(v);
    adj[b].pb(u);
    if (h) return h;
    for (int i=1;i<=n;i++) vis[i]=false;
    dfs(1);
    return h;
}

Compilation message

game.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> adj[N];
      | ^~~~~~
game.cpp: In function 'void dfs(int)':
game.cpp:8:17: error: 'adj' was not declared in this scope
    8 |     for (auto u:adj[node]){
      |                 ^~~
game.cpp: In function 'void init(int, int)':
game.cpp:18:7: error: 'nm' was not declared in this scope; did you mean 'nn'?
   18 |     n=nm;kk;
      |       ^~
      |       nn
game.cpp:18:10: warning: statement has no effect [-Wunused-value]
   18 |     n=nm;kk;
      |          ^~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:22:5: error: 'adj' was not declared in this scope
   22 |     adj[u].pb(v);
      |     ^~~
game.cpp:23:9: error: 'b' was not declared in this scope
   23 |     adj[b].pb(u);
      |         ^