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 <bits/stdc++.h>
#include "game.h"
using namespace std;
vector<int> graph[2000];
bool asked[2000][2000];
bool answer[2000][2000];
int n;
int hasEdge(int u, int v) {
if (graph[u].size() == 0 and graph[v].size() == 0)
{
graph[u].push_back(v);
graph[v].push_back(u);
asked[u][v] = true;
asked[v][u] = true;
answer[u][v] = true;
return 1;
}
if (graph[u].size() >= 1)
{
for (int i = 0; i < n; i++)
{
if (i != v and i != u and !asked[i][u])
{
asked[u][v] = true;
asked[v][u] = true;
return 0;
}
}
}
if (graph[v].size() >= 1)
{
for (int i = 0; i < n; i++)
{
if (i != u and i != v and !asked[i][v])
{
asked[u][v] = true;
asked[v][u] = true;
return 0;
}
}
}
graph[v].push_back(u);
graph[u].push_back(v);
asked[u][v] = true;
answer[u][v] = true;
asked[v][u] = true;
answer[v][u] = true;
return 1;
}
void initialize(int N) {
n = N;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |