# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
599997 | daisy2 | Game (IOI14_game) | C++14 | 381 ms | 10304 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<vector>
using namespace std;
int par[1505];
bool used[1505][1505];
vector<int> com;
void initialize(int n) {
com.push_back(1);
for(int i=1;i<=n;i++)
{
par[i]=i;
}
}
int find_par(int vr)
{
if(vr==par[vr]) return vr;
return par[vr]=find_par(par[vr]);
}
int hasEdge(int u, int v) {
u++;v++;
used[u][v]=used[v][u]=1;
u=find_par(u);
v=find_par(v);
if(u!=1 && v!=1)
return 0;
if(u==1 && v==1)
return 0;
if(v==1) swap(u,v);
for(int i=0;i<com.size();i++)
{
if(!used[v][com[i]])
{
return 0;
}
}
par[v]=u;
com.push_back(v);
return 1;
}
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... |