답안 #288702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
288702 2020-09-01T19:15:05 Z Kastanda Amusement Park (JOI17_amusement_park) C++14
10 / 100
32 ms 5328 KB
// M
#include<bits/stdc++.h>
#include "Joi.h"
using namespace std;
static const int N = 10004, LG = 60;
static int n, ts, M[N], C[N];
static vector < int > Adj[N], Ch[N];
static void DFS(int v)
{
        M[v] = 1;
        for (int u : Adj[v])
                if (!M[u])
                        Ch[v].push_back(u), DFS(u);
}
static void Build(int v)
{
        for (int u : Ch[v])
                Build(u);
        C[v] = ts ++;
        ts %= LG;
}
void Joi(int _n, int m, int A[], int B[], long long X, int T)
{
        n = _n;
        for (int i = 0; i < m; i ++)
                Adj[A[i]].push_back(B[i]),
                Adj[B[i]].push_back(A[i]);

        for (int i = 0; i < n; i ++)
                sort(Adj[i].begin(), Adj[i].end());
        DFS(0);
        Build(0);
        for (int i = 0; i < n; i ++)
                MessageBoard(i, (X >> C[i]) & 1LL);
}
// M
#include<bits/stdc++.h>
#include "Ioi.h"
using namespace std;
static const int N = 10004, LG = 60;
static int n, ts, M[N], C[N];
static vector < int > Adj[N], Ch[N];
void DFS2(int v)
{
        M[v] = 1;
        for (int u : Adj[v])
                if (!M[u])
                        Ch[v].push_back(u), DFS2(u);
}
void Build2(int v)
{
        for (int u : Ch[v])
                Build2(u);
        C[v] = ts ++;
        ts %= LG;
}
void Solve2(int v, int mrk)
{
        M[C[v]] = mrk;
        for (int u : Adj[v])
                if (M[C[u]] == -1)
                {
                  int tmp = Move(u);
                  	Solve2(u, tmp);
                  assert(Move(v) == mrk);
                }
}
long long Ioi(int _n, int m, int A[], int B[], int P, int V, int T)
{
        n = _n;
        for (int i = 0; i < m; i ++)
                Adj[A[i]].push_back(B[i]),
                Adj[B[i]].push_back(A[i]);

        for (int i = 0; i < n; i ++)
                sort(Adj[i].begin(), Adj[i].end());
        DFS2(0);
        Build2(0);

        memset(M, -1, sizeof(M));
        Solve2(P, V);

        long long X = 0;
        for (int i = 0; i < LG; i ++)
                if (M[i]) X |= 1LL << i;
        return X;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1824 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 5168 KB Output is correct
2 Incorrect 31 ms 5220 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1796 KB Output is correct
2 Correct 2 ms 1796 KB Output is correct
3 Correct 2 ms 1796 KB Output is correct
4 Correct 4 ms 2344 KB Output is correct
5 Correct 4 ms 2212 KB Output is correct
6 Correct 4 ms 2344 KB Output is correct
7 Correct 4 ms 2340 KB Output is correct
8 Correct 4 ms 2340 KB Output is correct
9 Correct 16 ms 5120 KB Output is correct
10 Correct 15 ms 5328 KB Output is correct
11 Correct 16 ms 5320 KB Output is correct
12 Correct 2 ms 2052 KB Output is correct
13 Correct 2 ms 1820 KB Output is correct
14 Correct 2 ms 1796 KB Output is correct
15 Correct 2 ms 1796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 5120 KB Output is correct
2 Correct 32 ms 5300 KB Output is correct
3 Correct 31 ms 5312 KB Output is correct
4 Incorrect 19 ms 3772 KB Wrong Answer [7]
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 5308 KB Output is correct
2 Correct 31 ms 5220 KB Output is correct
3 Correct 32 ms 5296 KB Output is correct
4 Correct 19 ms 3892 KB Output is correct
5 Incorrect 19 ms 5060 KB Wrong Answer [7]
6 Halted 0 ms 0 KB -