# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201672 | DavidDamian | Game (IOI14_game) | C++11 | 0 ms | 0 KiB |
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;
int n;
void initialize(int N) {
n=N;
}
vector<short> nodes;
vector<short> adjList[1505];
void dfs(int u,int e)
{
nodes.push_back(u);
for(int v: adjList[u]){
if(e==v) continue;
dfs(v,u);
}
}
short asked[1505][1505];
int hasEdge(short u, short v) {
nodes.clear();
asked[u][v]=1;
asked[v][u]=1;
adjList[u].push_back(v);
adjList[v].push_back(u);
dfs(u,-1);
for(short i: nodes){
for(short j: nodes){
if(i==j) continue;
if(asked[i][j]==0){
adjList[u].pop_back();
adjList[v].pop_back();
return 0;
}
}
}
return 1;
}