Submission #850101

# Submission time Handle Problem Language Result Execution time Memory
850101 2023-09-15T18:11:56 Z alexdd Amusement Park (JOI17_amusement_park) C++17
0 / 100
17 ms 4236 KB
#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
static bool visited[10005];
static vector<int> ord;
static vector<int> con[10005];
static bool done[10005];
static void dfs(int nod)
{
    visited[nod]=1;
    sort(con[nod].begin(),con[nod].end());
    ord.push_back(nod);
    for(auto adj:con[nod])
    {
        if(!visited[adj])
        {
            dfs(adj);
            ord.push_back(nod);
        }
    }
}
void Joi(int N, int M, int A[], int B[], long long X, int T)
{
    ord.clear();
    for(int i=0;i<N;i++)
    {
        visited[i]=0;
        con[i].clear();
        done[i]=0;
    }

    for(int i=0;i<M;i++)
    {
        con[A[i]].push_back(B[i]);
        con[B[i]].push_back(A[i]);
    }
    dfs(0);
    int cnt=0;
    for(int i=0;i<(int)ord.size();i++)
    {
        if(!done[ord[i]])
        {
            if(((1LL<<cnt)&X))
                MessageBoard(ord[i],1);
            else
                MessageBoard(ord[i],0);
            cnt++;
            done[ord[i]]=1;
        }
    }
}


#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
static bool visited[10005];
static vector<int> ord;
static vector<int> con[10005];
static bool done[10005];
static int p[50005];
static int poz[10005];
static int fr[65];
static int care[10005];
static map<pair<int,int>,int> mp;
static void dfs(int nod)
{
    visited[nod]=1;
    sort(con[nod].begin(),con[nod].end());
    poz[nod]=ord.size();
    ord.push_back(nod);
    for(auto adj:con[nod])
    {
        if(!visited[adj])
        {
            dfs(adj);
            ord.push_back(nod);
        }
    }
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
    return -1;
    ord.clear();
    for(int i=0;i<N;i++)
    {
        visited[i]=0;
        con[i].clear();
        done[i]=0;
    }
    for(int i=0;i<60;i++)
        fr[i]=0;

    for(int i=0;i<M;i++)
    {
        con[A[i]].push_back(B[i]);
        con[B[i]].push_back(A[i]);
        mp[{A[i],B[i]}]++;
        mp[{B[i],A[i]}]++;
    }
    dfs(0);
    int cnt=0;
    for(int i=0;i<(int)ord.size();i++)
    {
        if(!done[ord[i]])
        {
            care[ord[i]]=cnt;
            cnt=(cnt+1)%60;
            done[ord[i]]=1;
        }
        p[i]=care[ord[i]];
    }
    long long rez=0;
    int cate=0;
    return -1;
    for(int i=poz[P];i<(int)ord.size();i++)
    {
        if(fr[p[i]]==0)
        {
            if(V==1) rez += (1LL<<(p[i]));
            fr[p[i]]=1;
            cate++;
            if(cate==60)
                return rez;
        }
        if(i+1<(int)ord.size())
        {
            if(mp[{ord[i],ord[i+1]}]==0)
                return -1;
            V = Move(ord[i+1]);
        }
    }
    return -1;
    for(int i=(int)ord.size()-1;i>=0;i--)
    {
        if(fr[p[i]]==0)
        {
            if(V==1) rez += (1LL<<(p[i]));
            fr[p[i]]=1;
            cate++;
            if(cate==60)
                return rez;
        }
        V = Move(ord[i-1]);
    }
    return rez;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1304 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4236 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1304 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3696 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3432 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -