This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
const int N = 1503;
int n;
bool a[N][N];
void initialize(int n)
{
::n = n;
for (int x = 1; x <= n; ++x)
{
for (int y = 1; y <= n; ++y)
{
a[x][y] = true;
}
}
}
bool c[N];
bool dfs(int x, int y, int xx, int yy)
{
c[x] = true;
if (x == y)
return true;
for (int h = 1; h <= n; ++h)
{
if (x == xx && h == yy)
continue;
if (a[x][h])
{
if (!c[h])
{
if (dfs(h, y, xx, yy))
return true;
}
}
}
return false;
}
int hasEdge(int x, int y)
{
++x;
++y;
memset(c, false, sizeof c);
if (dfs(x, y, x, y))
{
a[x][y] = false;
a[y][x] = false;
return 0;
}
a[x][y] = false;
a[y][x] = false;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |