# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604577 | 2022-07-25T07:50:13 Z | Monchito | ICC (CEOI16_icc) | C++17 | 0 ms | 0 KB |
//-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)){ vector<int> x, y; x.pb(i); y.pb(j); if(query(1, 1, x, y) == 1) a=i,b=j; } } setRoad(a, b); } }