# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019990 | presko | Game (IOI14_game) | C++14 | 268 ms | 22772 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<iostream>
#include<vector>
#include "game.h"
#define MAXN 3000
using namespace std;
bool bfl=1;
bool used[MAXN][MAXN];
bool comp[MAXN];
vector<int> order;
void initialize(int n)
{
}
int hasEdge(int u, int v)
{
u++;v++;
if(bfl)
{
bfl=0;
order.push_back(u);
order.push_back(v);
comp[u]=1;
comp[v]=1;
used[u][v]=1;
used[v][u]=1;
return 1;
}
if(!comp[u] && comp[v])
{
int cntr=0;
for(int i=0;i<order.size();i++)
{
if(!used[u][order[i]])cntr++;
}
if(cntr==1)
{
comp[u]=1;
order.push_back(u);
used[u][v]=1;
used[v][u]=1;
return 1;
}
}
else if(comp[u] && !comp[v])
{
int cntr=0;
for(int i=0;i<order.size();i++)
{
if(!used[v][order[i]])cntr++;
}
if(cntr==1)
{
comp[v]=1;
order.push_back(v);
used[u][v]=1;
used[v][u]=1;
return 1;
}
}
used[u][v]=1;
used[v][u]=1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |