답안 #712891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
712891 2023-03-20T11:19:21 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[300005];
ll df[300005];
ll cur=0;
int n,k;
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:16:25: error: 'i' was not declared in this scope
   16 |     if(df[u]==1) return i>=k;
      |                         ^