Submission #385667

#TimeUsernameProblemLanguageResultExecution timeMemory
385667victoriadGame (IOI14_game)C++14
0 / 100
1 ms364 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 x;
int a,b;
vector<int>g;
void initialize(int n) {
a=-1;
b=-1;
g.assign(n,n-1);
}

int hasEdge(int u, int v) {
    if(g[u]>2 && g[v]>2){
        g[u]--;
        g[v]--;
        return 0;
    }
    else if(g[u]==2 && g[v]==2){
        if(a==-1 && b==-1){
            a=u;
            b=v;
            g[u]--;
            g[v]--;
            return 0;
        }
        else{
            return 1;
        }
    }
    else{
        if(a==-1 && b==-1){
            a=u;
            g[u]--;
            g[v]--;
            return 0;
        }
        else 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;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...