답안 #49375

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49375 2018-05-28T03:52:05 Z fallingstar Amusement Park (JOI17_amusement_park) C++17
10 / 100
40 ms 5792 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(0);
}
#include "Ioi.h"
#include <iostream>
#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(0);
    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 && it != a.end(); ++moves)
    {
        x |= (long) Move(*it) << id[*it];
        ++it;
    }
    return x;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1124 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 4780 KB Output is correct
2 Correct 36 ms 5536 KB Output is correct
3 Correct 35 ms 5552 KB Output is correct
4 Correct 40 ms 5552 KB Output is correct
5 Incorrect 19 ms 5552 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5552 KB Output is correct
2 Correct 5 ms 5552 KB Output is correct
3 Correct 4 ms 5552 KB Output is correct
4 Correct 7 ms 5552 KB Output is correct
5 Correct 7 ms 5552 KB Output is correct
6 Correct 6 ms 5552 KB Output is correct
7 Correct 6 ms 5552 KB Output is correct
8 Correct 7 ms 5552 KB Output is correct
9 Correct 18 ms 5552 KB Output is correct
10 Correct 18 ms 5552 KB Output is correct
11 Correct 18 ms 5552 KB Output is correct
12 Correct 4 ms 5552 KB Output is correct
13 Correct 4 ms 5552 KB Output is correct
14 Correct 5 ms 5552 KB Output is correct
15 Correct 5 ms 5552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 5644 KB Output is correct
2 Incorrect 33 ms 5736 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 5764 KB Output is correct
2 Correct 33 ms 5792 KB Output is correct
3 Incorrect 35 ms 5792 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -