제출 #433857

#제출 시각아이디문제언어결과실행 시간메모리
433857medmdg게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h"
#include<bits/stdc++.h>
#define ll int
using namespace std;
vector<ll> c;
vector<bool> vis;
ll h=0;
void initialize(int n) {
    c.clear();
    vis.clear();
    for(int i=0;i<n;i++){
        c.push_back(0);
        vis.push_back(false);
    }
}

int hasEdge(int u, int v) {
    h++;
    if(h==n)    return 1;
    u--;
    v--;
    c[u]++;
    c[v]++;
    if((c[u]==n&&!vis[u])||c[v]==n&&!vis[v]){
        vis[u]=true;
        vis[v]=true;
        return 1;
    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:19:11: error: 'n' was not declared in this scope
   19 |     if(h==n)    return 1;
      |           ^
game.cpp:24:15: error: 'n' was not declared in this scope
   24 |     if((c[u]==n&&!vis[u])||c[v]==n&&!vis[v]){
      |               ^