# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
380831 |
2021-03-23T08:48:58 Z |
IloveN |
Game (IOI14_game) |
C++14 |
|
1 ms |
364 KB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(vr) vr.begin(),vr.end()
#define vi vector<int>
#define vll vector<ll>
const int N=2e3+10;
int n, root[N], mark[N][N];
vi S[N];
void merg(int u, int v)
{
if (S[u].size() < S[v].size()) swap(u, v);
for (int x : S[v]) root[x] = u, S[u].eb(x);
S[v].clear();
}
void initialize(int x)
{
n = x;
for (int i = 0; i < n; ++i) root[i] = i, S[i].eb(i);
}
int count_edge(int u, int v)
{
int res = 0;
for (int x : S[u])
for (int y : S[v]) res += mark[x][y] ^ 1;
return res;
}
int hasEdge(int u, int v)
{
int ru = root[u];
int rv = root[v];
int cnt = count_edge(ru, rv);
if (cnt > 1) return 0;
merg(ru, rv);
mark[u][v] = 1;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |