Submission #49373

# Submission time Handle Problem Language Result Execution time Memory
49373 2018-05-28T03:39:59 Z fallingstar Amusement Park (JOI17_amusement_park) C++17
10 / 100
45 ms 6224 KB
#include "Joi.h"
#include <vector>

using namespace std;

#define long long long

static const int N = 1e4 + 2;

int GetBit(long x, int idx) { return (x >> idx) & 1; }

static vector<int> g[N];
static bool vst[N];
static int tme = 0;
static long mess;

static void Dfs(int u)
{
    vst[u] = true;
    MessageBoard(u, GetBit(mess, tme++ % 60));
    for (int v: g[u])
        if (!vst[v])
            Dfs(v);
}

void Joi(int n, int m, int A[], int B[], long _mess, int subtask)
{
    mess = _mess;
    for (int i = 0; i < m; ++i)
    {
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    Dfs(1);
}
#include "Ioi.h"
#include <algorithm>
#include <vector>

#define long long long

using namespace std;

static const int N = 1e4 + 2;

static vector<int> g[N];
static bool vst[N];
static int tme = 0, id[N];
static vector<int> a;

static void Dfs(int u)
{
    vst[u] = true;
    id[u] = tme++ % 60;
    for (int v: g[u])
        if (!vst[v])
        {
            a.push_back(v);
            Dfs(v);
            a.push_back(u);
        }
}


long Ioi(int n, int m, int A[], int B[], int start, int num, int subtask)
{
    for (int i = 0; i < m; ++i)
    {
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    Dfs(1);
    a.insert(a.end(), a.begin(), a.end());
    long x = 0;
    x |= (long) num << id[start];
    auto it = ++find(a.begin(), a.end(), start);
    for (int moves = 0; moves < 120; ++moves)
    {
        x |= (long) Move(*it) << id[*it];
        ++it;
    }
    return x;
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1124 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 45 ms 4408 KB Output is correct
2 Correct 39 ms 5128 KB Output is correct
3 Correct 33 ms 5380 KB Output is correct
4 Correct 28 ms 5632 KB Output is correct
5 Incorrect 28 ms 5632 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5632 KB Output is correct
2 Correct 4 ms 5632 KB Output is correct
3 Correct 4 ms 5632 KB Output is correct
4 Correct 7 ms 5632 KB Output is correct
5 Correct 7 ms 5632 KB Output is correct
6 Correct 9 ms 5632 KB Output is correct
7 Correct 6 ms 5632 KB Output is correct
8 Correct 6 ms 5632 KB Output is correct
9 Correct 15 ms 5876 KB Output is correct
10 Correct 19 ms 6120 KB Output is correct
11 Correct 19 ms 6120 KB Output is correct
12 Correct 5 ms 6120 KB Output is correct
13 Correct 4 ms 6120 KB Output is correct
14 Correct 5 ms 6120 KB Output is correct
15 Correct 9 ms 6120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 6168 KB Output is correct
2 Incorrect 33 ms 6216 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 6220 KB Output is correct
2 Correct 32 ms 6224 KB Output is correct
3 Incorrect 30 ms 6224 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -