# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30432 | kavun | Game (IOI14_game) | C++14 | 0 ms | 26496 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, cc[2000], ccsize[2000], asked[2000][2000];
vector <int> ver[2000];
void initialize(int n) {
N = n;
for(int i = 0; i < n; i++)
cc[i] = i, ver[i].push_back(i);
}
int hasEdge(int u, int v) {
if(cc[u] == cc[v])
return 1;
if(asked[cc[u]][cc[v]] == ccsize[cc[u]]*ccsize[cc[v]]-1)
{
ccsize[v] += ccsize[u];
for(int i = 0; i < ver[cc[u]].size(); i++)
ver[cc[v]].push_back(ver[cc[u]][i]),cc[ver[cc[u]][i]] = cc[v];
return 1;
}
else
{
asked[cc[u]][cc[v]]++;
asked[cc[v]][cc[u]]++;
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... |