Submission #774032

#TimeUsernameProblemLanguageResultExecution timeMemory
774032danikoynovGame (IOI14_game)C++14
42 / 100
29 ms2040 KiB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 81;
int n;

int edge[maxn][maxn], used[maxn];
void initialize(int N)
{
    n = N;
    for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
    {
        if (i != j)
        edge[i][j] = edge[j][i] = 1;
    }
}

void dfs(int v)
{
    used[v] = 1;
    for (int u = 0; u < n; u ++)
    {
        if (!used[u] && edge[v][u] > 0)
            dfs(u);
    }
}
int hasEdge(int u, int v)
{
    edge[u][v] = edge[v][u] = 0;
    for (int i = 0; i < n; i ++)
        used[i] = 0;
    dfs(0);
    //for (int i = 0; i < n; i ++)
      //  cout << used[i] << endl;
    for (int i = 0; i < n; i ++)
    {
        if (used[i] == 0)
        {
            edge[u][v] = edge[v][u] = 1;
            return 1;
        }
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...