Submission #1204443

#TimeUsernameProblemLanguageResultExecution timeMemory
1204443banganConnecting Supertrees (IOI20_supertrees)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
// #define int long long
#define i2 array<int, 2>
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)
#define all(a) a.begin(), a.end()
#define rep(i,l,r) for (int i=(l); i<=(r); i++)

#ifndef LOCAL
#define gcd __gcd
#endif

const int N = 1e3+4;

int par[N], sz[N];
int root(int v) {
    return par[v]==v ? v : par[v]=root(par[v]);
}
int mrg(int v, int u) {
    v=root(v); u=root(u);
    if (v==u) return 0;
    if (sz[v]<sz[u]) swap(v,u);
    sz[v]+=sz[u]; par[u]=v;
    return 1;
}

void init() {
    rep(i, 0, N-1) par[i]=i, sz[i]=1;
}

int construct(vector<vector<int>> p) {
    for (auto x:p) for (auto y:x) assert(0<=y && y<=1);
    init();
    int n = p.size();
    vector adj(n, vector<int>(n));
    rep(i, 0, n-1) rep(j, 0, n-1) if (p[i][j] && mrg(i,j)) adj[i][j]=1;
    rep(i, 0, n-1) adj[i][i]=1;
    build(adj); return 1;
}  

// int32_t main() {
//     ios::sync_with_stdio(false); cin.tie(nullptr);



//     return 0;
// }

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:41:5: error: 'build' was not declared in this scope
   41 |     build(adj); return 1;
      |     ^~~~~