답안 #712890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712890 2023-03-20T11:19:01 Z irmuun 게임 (APIO22_game) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "game.h"
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define PI 3.1415926535897932384626433
#define all(s) s.begin(),s.end()
vector<ll>dv[30005];
ll df[30005];
ll cur=0;
bool dfs(ll u){
    if(df[u]==2) return true;
    if(df[u]==1) return i>=k;
    df[u]=1;
    for(auto x:dv[u]){
        if(dfs(x)==false){
            return false;
        }
    }
    df[u]=2;
    return true;
}

void init(int N,int K){
    n=N;
    k=K;
    for(int i=0;i<=k-2;i++){
        dv[i].pb(i+1);
    }
}
int add_teleporter(int u,int v){
    dv[u].pb(v);
    for(ll i=0;i<n;i++) df[i]=0;
    bool ok=dfs(0);
    if(ok==false){
        return 1;
    }
    else{
        return 0;
    }
}

Compilation message

game.cpp: In function 'bool dfs(long long int)':
game.cpp:15:25: error: 'i' was not declared in this scope
   15 |     if(df[u]==1) return i>=k;
      |                         ^
game.cpp:15:28: error: 'k' was not declared in this scope
   15 |     if(df[u]==1) return i>=k;
      |                            ^
game.cpp: In function 'void init(int, int)':
game.cpp:27:5: error: 'n' was not declared in this scope
   27 |     n=N;
      |     ^
game.cpp:28:5: error: 'k' was not declared in this scope
   28 |     k=K;
      |     ^
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:35:18: error: 'n' was not declared in this scope
   35 |     for(ll i=0;i<n;i++) df[i]=0;
      |                  ^