# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
640198 | | ymm | Game (IOI14_game) | C++17 | | 380 ms | 25256 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>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
static const int N = 1510;
static int par[N], sz[N], ask[N][N];
static int root(int v) { return par[v] == -1? v: (par[v] = root(par[v])); }
void initialize(int n) {
fill(par, par+N, -1);
fill(sz, sz+N, 1);
}
int hasEdge(int u, int v) {
v = root(v); u = root(u);
ask[v][u]++;
ask[u][v]++;
if (ask[v][u] == sz[v] * sz[u]) {
par[u] = v;
sz[v] += sz[u];
Loop (i,0,N) {
ask[v][i] += ask[u][i];
ask[i][v] += ask[i][u];
}
return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |