# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
349733 |
2021-01-18T09:41:44 Z |
Pety |
Game (IOI14_game) |
C++14 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
using namespace std;
int n, sz[2000], p[2000], cnt[10][10];
int find (int x) {
if (p[x] == x)
return x;
return p[x] = find(p[x]);
}
void Union (int x, int y) {
if (x != y) {
if (sz[x] < sz[y])
swap(x, y);
for (int i = 1; i <= n; i++) {
cnt[i][x] += cnt[i][y];
cnt[x][i] += cnt[i][y];
}
p[y] = x;
}
return;
}
void initialize(int m) {
n = m;
for (int i = 1; i <= n; i++) {
sz[i] = 1;
p[i] = i;
for (int j = 1; j <= n; j++)
cnt[i][j] = (i != j);
}
}
int hasEdge (int x, int y) {
x = find(x);
y = find(y);
if (x == y)
return 0;
if (cnt[x][y] > 1) {
cnt[x][y]--;
cnt[y][x]--;
return 0;
}
Union(x, y);
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 |
0 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |