Submission #491281

# Submission time Handle Problem Language Result Execution time Memory
491281 2021-12-01T10:32:09 Z blue Amusement Park (JOI17_amusement_park) C++17
18 / 100
31 ms 4800 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);

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

    dfs2(0);

    return X;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1764 KB Output is correct
2 Correct 1 ms 1772 KB Output is correct
3 Correct 2 ms 1804 KB Output is correct
4 Correct 0 ms 1632 KB Output is correct
5 Correct 2 ms 1772 KB Output is correct
6 Correct 1 ms 1764 KB Output is correct
7 Correct 2 ms 1772 KB Output is correct
8 Correct 2 ms 1776 KB Output is correct
9 Correct 2 ms 1776 KB Output is correct
10 Correct 2 ms 1772 KB Output is correct
11 Correct 4 ms 2084 KB Output is correct
12 Correct 2 ms 1764 KB Output is correct
13 Correct 2 ms 1776 KB Output is correct
14 Correct 2 ms 1776 KB Output is correct
15 Correct 1 ms 1776 KB Output is correct
16 Correct 2 ms 1776 KB Output is correct
17 Correct 2 ms 1776 KB Output is correct
18 Correct 2 ms 1780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 4616 KB Output is correct
2 Correct 22 ms 4620 KB Output is correct
3 Correct 20 ms 4596 KB Output is correct
4 Correct 14 ms 3240 KB Output is correct
5 Correct 13 ms 3764 KB Output is correct
6 Correct 13 ms 3636 KB Output is correct
7 Correct 12 ms 3668 KB Output is correct
8 Correct 13 ms 3644 KB Output is correct
9 Correct 13 ms 3628 KB Output is correct
10 Correct 12 ms 3252 KB Output is correct
11 Correct 12 ms 3252 KB Output is correct
12 Correct 12 ms 3224 KB Output is correct
13 Correct 11 ms 3212 KB Output is correct
14 Correct 12 ms 3256 KB Output is correct
15 Correct 12 ms 3384 KB Output is correct
16 Correct 15 ms 3372 KB Output is correct
17 Correct 12 ms 3376 KB Output is correct
18 Correct 12 ms 3240 KB Output is correct
19 Correct 12 ms 3264 KB Output is correct
20 Correct 10 ms 3636 KB Output is correct
21 Correct 11 ms 3624 KB Output is correct
22 Correct 11 ms 3492 KB Output is correct
23 Correct 13 ms 3684 KB Output is correct
24 Correct 12 ms 3508 KB Output is correct
25 Correct 13 ms 3640 KB Output is correct
26 Correct 12 ms 3640 KB Output is correct
27 Correct 13 ms 3636 KB Output is correct
28 Correct 13 ms 3600 KB Output is correct
29 Correct 11 ms 3364 KB Output is correct
30 Correct 11 ms 3500 KB Output is correct
31 Correct 2 ms 1764 KB Output is correct
32 Correct 1 ms 1772 KB Output is correct
33 Correct 2 ms 1768 KB Output is correct
34 Correct 1 ms 1772 KB Output is correct
35 Correct 1 ms 1764 KB Output is correct
36 Correct 1 ms 1644 KB Output is correct
37 Correct 1 ms 1636 KB Output is correct
38 Correct 0 ms 1644 KB Output is correct
39 Correct 1 ms 1764 KB Output is correct
40 Correct 1 ms 1680 KB Output is correct
41 Correct 2 ms 1772 KB Output is correct
42 Correct 1 ms 1632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1764 KB Output is correct
2 Correct 2 ms 1728 KB Output is correct
3 Correct 2 ms 1764 KB Output is correct
4 Correct 3 ms 2188 KB Output is correct
5 Incorrect 3 ms 2204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 4800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 4680 KB Output isn't correct
2 Halted 0 ms 0 KB -