#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 16;
int pai[maxn], h[maxn];
int n;
int find(int u) {
if(pai[u] == u) return u;
return pai[u] = find(pai[u]);
}
void join(int a, int b) {
a = find(a);
b = find(b);
if(h[a] < h[b]) swap(h[a], h[b]);
pai[b] = a;
if(h[a]==h[b]) h[a]++;
}
void run(int n_) {
n = n_;
for(int i=1;i<=n;i++)
pai[i] = i;
for(int k=1;k<n;k++) {
bool certo = false;
for(int i=1;i<=n;i++) {
for(int j=i+1;j<=n;j++) {
if(find(i) == find(j)) continue;
int a[] = {i};
int b[] = {j};
bool x = query(1,1, a, b);
if(x) {
certo = true;
setRoad(i, j);
break;
}
}
if(certo) break;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
504 KB |
Ok! 1015 queries used. |
2 |
Correct |
65 ms |
504 KB |
Ok! 1010 queries used. |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |