# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429561 | TLP39 | Game (IOI14_game) | C++14 | 504 ms | 25480 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>
int n;
std :: vector<int> ver[1503];
int par[1503];
int link[1503][1503];
void initialize(int N) {
n=N;
for(int i=0;i<n;i++)
{
par[i]=i;
ver[i].push_back(i);
}
memset(link,0,sizeof link);
}
int hasEdge(int u, int v) {
int x=par[u],y=par[v];
if(link[x][y]!=(ver[x].size())*(ver[y].size())-1)
{
link[x][y]++;
link[y][x]++;
return 0;
}
for(int i=0;i<ver[y].size();i++)
{
ver[x].push_back(ver[y][i]);
par[ver[y][i]]=x;
}
ver[y].clear();
for(int i=0;i<n;i++)
{
if(!ver[i].size() || i==x) continue;
link[x][i]+=link[y][i];
link[y][i]=0;
link[i][y]=0;
link[i][x]=link[x][i];
}
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... |