# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
162632 |
2019-11-09T06:59:16 Z |
demetre |
Game (IOI14_game) |
C++14 |
|
3 ms |
632 KB |
#include<bits/stdc++.h>
using namespace std;
int N, n, a, b, f[1001][1001], fix[1001], p[1001];
void initialize (int n) {
N = n;
for (int i=0; i<N; i++){
p[i] = i;
fix[i] = 1;
}
}
int getcol (int l){
if (l == p[l])
return l;
return getcol (p[l]);
}
void col (int k, int l){
int w = getcol(k);
int u = getcol(l);
p[w] = u;
fix[u]+=fix[w];
fix[w] = 0;
p[k] = l;
for (int i = 0; i < N; i++){
f[u][i]+=f[w][i];
f[i][u]+=f[i][w];
}
}
int hasEdge (int u, int v){
cin >> a >> b;
a = getcol(a);
b = getcol(b);
f[a][b]++;
f[b][a]++;
if (f[a][b] == fix[a]*fix[b]){
return 1;
if (fix[a] >= fix[b])
swap(a, b);
col (a, b);
}
else
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |