답안 #313033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313033 2020-10-15T02:25:51 Z alexhu 게임 (IOI14_game) C++14
컴파일 오류
0 ms 0 KB
/**
 * https://oj.uz/problem/view/IOI14_game
 * */
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>graph(1500,vector<int>(1500,0));
int N;
void initialize(int n){
    N=n;
}
int hasEdge(int u,int v){
    graph[u][v]=2;
    graph[v][u]=2;
    if(dfs()){
        return 0;
    }else{
        graph[u][v]=1;
        graph[v][u]=1;
        return 1;
    }
}
bool dfs(){
    list<int>q;
    vector<int>visited(N,0);
    q.push_back(0);
    visited[0]=1;
    while(!q.empty()){
        int x=q.front();
        q.pop_front();
        for(int i=0;i<N;i++){
            if(x!=i&&graph[x][i]!=2&&!visited[i]){
                q.push_back(i);
                visited[i]=1;
            }
        }
    }
    return [&]()->bool{
        for(int i=0;i<N;i++){
            if(!visited[i]){
                return false;
            }
        }
        return true;
    }();
}

Compilation message

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:14:8: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   14 |     if(dfs()){
      |        ^~~
      |        ffs
game.cpp:13:16: warning: control reaches end of non-void function [-Wreturn-type]
   13 |     graph[v][u]=2;