제출 #385920

#제출 시각아이디문제언어결과실행 시간메모리
385920victoriad게임 (IOI14_game)C++14
0 / 100
2 ms492 KiB
#include "game.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <stack>
#include <fstream>
using namespace std;
int a,b,x;
vector<int>g;
vector<int>p;
void initialize(int n) {
a=-1;
b=-1;
g.assign(n,n-1);
g.assign(n,-1);
x=(n*(n-1))/2;
}
 
int hasEdge(int u, int v) {
    
    if(g[u]>2 && g[v]>2){
        g[u]--;
        g[v]--;
        return 0;
    }
    else if(g[u]==1 || g[v]==1){
        if(g[u]==1){
            p[u]=u;
            p[v]=u;
        }
        else{
            p[u]=v;
            p[v]=v;
        }
        return 1;
    }
    else if(a!=-1 && b!=-1){
        return 1;
    }
    else if(g[u]==2 && g[v]==2){
        if(a==-1 && b==-1 && p[u]==-1 && p[v]==-1){
            a=u;
            b=v;
            g[u]--;
            g[v]--;
            return 0;
        }
        else{
            return 1;
        }
    }
    else{
        if( p[u]==-1 && p[v]==-1){
         if(a==-1){
            a=u;
            g[u]--;
            g[v]--;
            return 0;
        }
        else if(b==-1){
            b=u;
            g[u]--;
            g[v]--;
            return 0;
        }
        }
        else{
            return 1;
        }
    }
    
    
}

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

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
   79 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...