이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//-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);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |