//-Si puedes imaginarlo, puedes programarlo- Alejandro Taboada
#include <icc.h>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define fst first
#define snd second
#define pb push_back
#define sz(x) (int)x.size()
#define rep(i,x,n) for(__typeof(n)i=(x);i!=(n);i+=1-2*((x)>(n)))
#define dbg(x) cout << #x << "=" << x << " ";
#define line cout << "\n.......................................................\n";
struct DSU{
vector<int> p;
DSU(){}
DSU(int n){
p=vector<int>(n);
rep(i,0,n) p[i]=i;
}
int find(int x){
if(x!=p[x]) return p[x]=find(p[x]);
return x;
}
void merge(int u, int v){
int pu=find(u), pv=find(v);
p[pv] = pu;
}
};
void run(int N){
DSU dsu(N);
rep(k,0,N-1){
int a, b;
a = -1, b = -1;
rep(i,0,N) rep(j,i+1,N){
if (a != -1) break;
if(dsu.find(i) != dsu.find(j)){
int x[1],y[1];
x[0]=i+1, y[0]=j+1;
if(query(1, 1, x, y) == 1) a=i,b=j;
}
}
setRoad(a+1, b+1);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
468 KB |
Ok! 1015 queries used. |
2 |
Correct |
44 ms |
468 KB |
Ok! 1010 queries used. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
125 ms |
472 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
339 ms |
468 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
472 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
281 ms |
476 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
275 ms |
472 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |