Submission #300745

# Submission time Handle Problem Language Result Execution time Memory
300745 2020-09-17T13:03:40 Z Sho10 Connecting Supertrees (IOI20_supertrees) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,a[2005][2005],ans[2005][2005],par[2005],siz[2005];
ll caut(ll x){
if(x==par[x]){
    return x;
}else return par[x]=caut(par[x]);
}
ll uni(ll x,ll y){
x=caut(x);
y=caut(y);
ans[x][y]=1;
ans[y][x]=1;
if(siz[x]>siz[y]){
    swap(x,y);
}
siz[y]+=siz[x];
par[x]=y;
}
int construct(vector<vector<ll>>p){
n=p[0].size();
for(ll i=0;i<n;i++)
{
    for(ll j=0;j<n;j++)
    {
        a[i][j]=p[i-1][j-1];
    }
}
for(ll i=0;i<n;i++)
{
    par[i]=i;
}
for(ll i=0;i<n;i++)
{
    for(ll j=i+1;j<n;j++)
    {
        if(a[i][j]){
            if(caut(i)!=caut(j)){
                uni(i,j);
            }
        }
    }
}
/*
for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++)
{
    cout<<ans[i][j]<<' ';
}
cout<<endl;
}
*/
build(ans);
}
/*
int32_t main(){
CODE_START;
construct({1, 1, 2, 2}, {1, 1, 2, 2}, {2, 2, 1, 2], [2, 2, 2, 1]]);
}
*/

Compilation message

supertrees.cpp: In function 'long long int uni(long long int, long long int)':
supertrees.cpp:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
   40 | }
      | ^
supertrees.cpp: In function 'int construct(std::vector<std::vector<long long int> >)':
supertrees.cpp:74:1: error: 'build' was not declared in this scope
   74 | build(ans);
      | ^~~~~
supertrees.cpp:75:1: warning: no return statement in function returning non-void [-Wreturn-type]
   75 | }
      | ^