답안 #301076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
301076 2020-09-17T16:15:52 Z Sho10 슈퍼트리 잇기 (IOI20_supertrees) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "supertrees.h"
#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],pos[2005];
vector<ll>v;
int construct(vector<vector<int>>p){
n=p[0].size();
for(ll i=0;i<n;i++)
{
    for(ll j=0;j<n;j++)
    {
        a[i][j]=p[i][j];
    }
}
for(ll i=0;i<n;i++)
{
    if(viz[i]){
        continue;
    }
    v.clear();
    dfs(i,1ll);
    for(auto it1 : v){
        for(auto it2: v){
            if(a[it1][it2]!=1){
                return 0;
            }
        }
    }
    for(auto it : v){
        pos[it]=v[0];
    }
    for(ll j=1;j<v.size();j++)
    {
        ans[v[j]][v[j-1]]=1;
        ans[v[j-1]][v[j]]=1;
    }

}
memset(viz,0,sizeof(viz));
for(ll i=0;i<n;i++)
{
    if(viz[i]){
        continue;
    }
    v.clear();
    dfs(i,2);
    for(auto it1 : v){
for(auto it2 : v){
    if(a[it1][it2]==0){
        return 0;
    }
}
    }
    vector<ll>x;
    for(auto it : v){
        if(pos[it]==it){
            x.pb(it);
        }
    }
    if(x.size()<=1){
        continue;
    }
    if(x.size()==2){
        return 0;
    }
    for(ll j=0;j<x.size();j++)
    {
        ll nr=x.size();
        ll s1=x[j],s2=x[(j+1)%nr];
        ans[s1][s2]=1;
        ans[s2][s1]=1;
    }
}
vector<vector<int>>res;
res.resize(n);
for(ll i=0;i<n;i++)
{
    for(ll j=0;j<n;j++)
    {
       res[i].pb(ans[i][j]);
    }
}
build(res);
return 1;
}
/*
int32_t main(){
CODE_START;
*/

Compilation message

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:38:8: error: 'viz' was not declared in this scope
   38 |     if(viz[i]){
      |        ^~~
supertrees.cpp:42:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   42 |     dfs(i,1ll);
      |     ^~~
      |     ffs
supertrees.cpp:53:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(ll j=1;j<v.size();j++)
      |                ~^~~~~~~~~
supertrees.cpp:60:8: error: 'viz' was not declared in this scope
   60 | memset(viz,0,sizeof(viz));
      |        ^~~
supertrees.cpp:67:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   67 |     dfs(i,2);
      |     ^~~
      |     ffs
supertrees.cpp:87:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 |     for(ll j=0;j<x.size();j++)
      |                ~^~~~~~~~~