Submission #730909

# Submission time Handle Problem Language Result Execution time Memory
730909 2023-04-26T15:24:26 Z Rafi22 Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
//#include "Joi.h"

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

const int N=10007;

bool odw[N];
vector<int>G[N],G1[N];
vector<int>X[N];
int id[N];

vector<int>V;

void dfs(int v)
{
    if(sz(V)<60)
    {
        id[v]=sz(V);
        V.pb(v);
    }
    odw[v]=1;
    for(auto u:G[v])
    {
        if(!odw[u])
        {
            G1[u].pb(v);
            G1[v].pb(u);
            dfs(u);
        }
    }
}

bool is[N];

void dfs1(int v,int o)
{
    for(auto u:G1[v])
    {
        if(u==o) continue;
        if(sz(X[u])==0)
        {
            int l=-1;
            for(auto i:X[v]) is[i]=1;
            for(auto i:X[v])
            {
                int c=0;
                for(auto j:G1[i]) c+=is[j];
                if(c==1) l=i;
            }
            id[u]=id[l];
            for(auto i:X[v])
            {
                is[i]=0;
                if(i!=l) X[u].pb(i);
            }
            X[u].pb(u);
        }
        dfs1(u,v);
    }
}


void Joi(int n, int m, int A[], int B[], ll x, int tt)
{
    for(int i=0;i<m;i++)
    {
        G[A[i]].pb(B[i]);
        G[B[i]].pb(A[i]);
    }
    dfs(0);
    for(auto x:V) X[x]=V;
    dfs1(0,-1);
    for(int i=0;i<n;i++) MessageBoard(i,((1LL<<id[i])&x)>0);
}

#include <bits/stdc++.h>
//#include "Ioi.h"

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

const int N=10007;

bool odw[N];
vector<int>G[N],G1[N];
vector<int>X[N];
int id[N];

vector<int>V;

void dfs(int v)
{
    if(sz(V)<60)
    {
        id[v]=sz(V);
        V.pb(v);
    }
    odw[v]=1;
    for(auto u:G[v])
    {
        if(!odw[u])
        {
            G1[u].pb(v);
            G1[v].pb(u);
            dfs(u);
        }
    }
}

bool is[N];

void dfs1(int v,int o)
{
    for(auto u:G1[v])
    {
        if(u==o) continue;
        if(sz(X[u])==0)
        {
            int l=-1;
            for(auto i:X[v]) is[i]=1;
            for(auto i:X[v])
            {
                int c=0;
                for(auto j:G1[i]) c+=is[j];
                if(c==1) l=i;
            }
            id[u]=id[l];
            for(auto i:X[v])
            {
                is[i]=0;
                if(i!=l) X[u].pb(i);
            }
            X[u].pb(u);
        }
        dfs1(u,v);
    }
}

ll ans=0;

void dfs2(int v,int o)
{
    for(auto u:G[v])
    {
        if(u==o||!is[u]) continue;
        ll x=Move(u);
        ans+=x*(1LL<<id[u]);
        dfs2(u,v);
    }
    if(o!=-1) Move(o);
}

ll Ioi(int n, int m, int A[], int B[], int p, int v, int t)
{
    for(int i=0;i<m;i++)
    {
        G[A[i]].pb(B[i]);
        G[B[i]].pb(A[i]);
    }
    dfs(0);
    for(auto x:V) X[x]=V;
    dfs1(0,-1);
    ans+=(ll)v*(1LL<<id[p]);
    for(auto i:X[p]) is[i]=1;
    dfs2(p,-1);
    cout<<ans<<endl;
}

Compilation message

Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:85:26: error: 'MessageBoard' was not declared in this scope
   85 |     for(int i=0;i<n;i++) MessageBoard(i,((1LL<<id[i])&x)>0);
      |                          ^~~~~~~~~~~~

Ioi.cpp: In function 'void dfs2(int, int)':
Ioi.cpp:81:14: error: 'Move' was not declared in this scope
   81 |         ll x=Move(u);
      |              ^~~~
Ioi.cpp:85:15: error: 'Move' was not declared in this scope
   85 |     if(o!=-1) Move(o);
      |               ^~~~
Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:102:1: warning: no return statement in function returning non-void [-Wreturn-type]
  102 | }
      | ^