Submission #491280

# Submission time Handle Problem Language Result Execution time Memory
491280 2021-12-01T10:26:47 Z blue Amusement Park (JOI17_amusement_park) C++17
18 / 100
27 ms 4984 KB
#include "Joi.h"
#include <vector>
using namespace std;

using vi = vector<int>;
using ll = long long;

static const int maxN = 10'000;

static vi edge[maxN];

static vi parent(maxN);
static vi children[maxN];

static const int lg = 60;

static int ct = -1;
static vi bits(lg);

static vi visit(maxN, 0);

static void dfs(int u)
{
    ct = (ct + 1) % lg;
    MessageBoard(u, bits[ct]);
    visit[u] = 1;

    for(int v: edge[u])
    {
        if(visit[v]) continue;
        dfs(v);
    }
}

void Joi(int N, int M, int A[], int B[], ll X, int T)
{
    for(int e = 0; e < lg; e++)
    {
        bits[e] = X % 2LL;
        X /= 2LL;
    }

    for(int j = 0; j < M; j++)
    {
        edge[A[j]].push_back(B[j]);
        edge[B[j]].push_back(A[j]);
    }

    dfs(0);
}
#include "Ioi.h"
#include <vector>
using namespace std;

using vi = vector<int>;
using ll = long long;

static const int maxN = 10'000;

static vi edge[maxN];

static vi parent(maxN, -1);
static vi children[maxN];

static const int lg = 60;

static int ct = -1;
static vi bits(lg);

static vi visit(maxN, 0);

static vi ind(maxN);

static void dfs(int u)
{
    ct = (ct + 1) % lg;
    ind[u] = ct;
    visit[u] = 1;

    for(int v: edge[u])
    {
        if(visit[v]) continue;
        parent[v] = u;
        children[u].push_back(v);
        dfs(v);
    }
}

ll X = 0;

ll pow2[lg];

static void setbit(int b, int v)
{
    if(v)
        X += pow2[b];
}

static int mv;

static int set_count = 0;

static void dfs2(int u)
{
    if(set_count >= 60) return;
    set_count++;

    setbit(ind[u], mv);
    for(int v: children[u])
    {
        mv = Move(v);
        dfs2(v);
        mv = Move(u);
    }
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
    pow2[0] = 1;
    for(int e = 1; e < lg; e++)
        pow2[e] = 2LL * pow2[e-1];

    for(int j = 0; j < M; j++)
    {
        edge[A[j]].push_back(B[j]);
        edge[B[j]].push_back(A[j]);
    }

    dfs(0);


    while(P != 0)
    {
        mv = Move(parent[P]);
        P = parent[P];
    }

    dfs2(0);

    return X;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1764 KB Output is correct
2 Correct 2 ms 1776 KB Output is correct
3 Correct 1 ms 1776 KB Output is correct
4 Correct 2 ms 1776 KB Output is correct
5 Correct 1 ms 1756 KB Output is correct
6 Correct 1 ms 1728 KB Output is correct
7 Correct 2 ms 1764 KB Output is correct
8 Correct 2 ms 1784 KB Output is correct
9 Correct 2 ms 1780 KB Output is correct
10 Correct 1 ms 1768 KB Output is correct
11 Correct 5 ms 2100 KB Output is correct
12 Correct 2 ms 1768 KB Output is correct
13 Correct 2 ms 1780 KB Output is correct
14 Correct 2 ms 1780 KB Output is correct
15 Correct 1 ms 1772 KB Output is correct
16 Correct 2 ms 1752 KB Output is correct
17 Correct 1 ms 1780 KB Output is correct
18 Correct 2 ms 1780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 4984 KB Output is correct
2 Correct 22 ms 4964 KB Output is correct
3 Correct 24 ms 4944 KB Output is correct
4 Correct 12 ms 3464 KB Output is correct
5 Correct 13 ms 4096 KB Output is correct
6 Correct 15 ms 3856 KB Output is correct
7 Correct 13 ms 3772 KB Output is correct
8 Correct 12 ms 3852 KB Output is correct
9 Correct 14 ms 3848 KB Output is correct
10 Correct 12 ms 3472 KB Output is correct
11 Correct 12 ms 3480 KB Output is correct
12 Correct 12 ms 3324 KB Output is correct
13 Correct 11 ms 3324 KB Output is correct
14 Correct 12 ms 3456 KB Output is correct
15 Correct 17 ms 3568 KB Output is correct
16 Correct 14 ms 3592 KB Output is correct
17 Correct 13 ms 3524 KB Output is correct
18 Correct 18 ms 3448 KB Output is correct
19 Correct 13 ms 3472 KB Output is correct
20 Correct 12 ms 3824 KB Output is correct
21 Correct 11 ms 3852 KB Output is correct
22 Correct 13 ms 3596 KB Output is correct
23 Correct 12 ms 3828 KB Output is correct
24 Correct 12 ms 3652 KB Output is correct
25 Correct 13 ms 3852 KB Output is correct
26 Correct 12 ms 3848 KB Output is correct
27 Correct 18 ms 3772 KB Output is correct
28 Correct 13 ms 3912 KB Output is correct
29 Correct 11 ms 3528 KB Output is correct
30 Correct 13 ms 3588 KB Output is correct
31 Correct 2 ms 1776 KB Output is correct
32 Correct 2 ms 1768 KB Output is correct
33 Correct 2 ms 1764 KB Output is correct
34 Correct 2 ms 1752 KB Output is correct
35 Correct 1 ms 1768 KB Output is correct
36 Correct 1 ms 1776 KB Output is correct
37 Correct 1 ms 1776 KB Output is correct
38 Correct 1 ms 1768 KB Output is correct
39 Correct 1 ms 1760 KB Output is correct
40 Correct 2 ms 1776 KB Output is correct
41 Correct 2 ms 1748 KB Output is correct
42 Correct 1 ms 1768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1780 KB Output is correct
2 Correct 2 ms 1768 KB Output is correct
3 Correct 2 ms 1768 KB Output is correct
4 Incorrect 2 ms 2192 KB Wrong Answer [7]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4844 KB Output isn't correct
2 Halted 0 ms 0 KB -