Submission #393056

#TimeUsernameProblemLanguageResultExecution timeMemory
393056abdzagConnecting Supertrees (IOI20_supertrees)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<unordered_set> #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define rep(i,a,b) for(int i = a; i<int(b);++i) #define rrep(i,a,b) for(int i = a; i>int(b);--i) #define all(v) v.begin(),v.end() #define trav(a, x) for(auto& a : x) typedef long long ll; const long long inf = 1e15; using namespace std; void printint(vector < ll > vec) { for (auto a : vec) { cout << a << " "; } cout << endl; } bool sortcol(const vector<int>& v1, const vector<int>& v2) { return v1[1] < v2[1]; } void printsetint(set<ll> s) { for (auto it = s.begin(); it != s.end(); ++it) { cout << *it; } } void printsetpairint(set<pair<int, int>> s) { for (auto it = s.begin(); it != s.end(); ++it) { pair<int, int> cur = *it; cout << cur.first << " " << cur.second; } cout << endl; } void printsetstring(set<string> s) { for (auto it = s.begin(); it != s.end(); ++it) { cout << *it << endl; } } vector<ll> p(2001); vector<ll> Urank(2001); ll UfindSet(ll i) { if (p[i] == i)return i; return p[i] = UfindSet(p[i]); } void UjoinSet(ll i, ll j) { ll si = UfindSet(i); ll sj = UfindSet(j); if (sj == si) return; if (Urank[sj] > Urank[si]) swap(i, j); p[sj] = si; if (Urank[si] == Urank[sj])Urank[si]++; return; } ll construct(vector<vector<ll>> v) { rep(i, 0, p.size())p[i] = i; ll n = v.size(); rep(i, 0, n) { rep(j, 0, n) { if (v[i][j]) { UjoinSet(i, j); } } } vector<vector<ll>> ans(n, vector<ll>(n)); rep(i, 0, n) { if (p[i] != i) { ans[i][p[i]] = 1; ans[p[i]][i] = 1; } } build(ans); return 1; } int main() { cin.sync_with_stdio(false); ll m; cin >> m; vector<vector<ll>> g(m, vector<ll>(m)); rep(i, 0, m){ rep(j, 0, m) { cin >> g[i][j]; } } construct(g); return 0; }

Compilation message (stderr)

supertrees.cpp: In function 'll construct(std::vector<std::vector<long long int> >)':
supertrees.cpp:80:5: error: 'build' was not declared in this scope
   80 |     build(ans);
      |     ^~~~~