답안 #154507

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154507 2019-09-22T10:41:02 Z Mercenary Amusement Park (JOI17_amusement_park) C++14
10 / 100
32 ms 4256 KB
#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;

void Joi(int N, int M, int A[], int B[], long long X, int T) {
    const static int maxn = 1e4 + 5;
    static int lab[maxn];
    static int nTime = 0;
    static int id[maxn];
    vector<int> adj[maxn];
    fill_n(lab,maxn,-1);
    function<int(int)> FindLab = [&](int u){
        return lab[u] < 0 ? u : lab[u] = FindLab(lab[u]);
    };
    for(int i = 0 ; i < M ; ++i){
        int s = FindLab(A[i]);
        int d = FindLab(B[i]);
        if(s != d){
            lab[s] += lab[d];
            lab[d] = s;
            adj[A[i]].push_back(B[i]);
            adj[B[i]].push_back(A[i]);
        }
    }
    function<void(int,int)> DFS = [&](int u , int par){
        id[u] = nTime;
        nTime = (nTime + 1) % 60;
        for(int c : adj[u]){
            if(c != par){
                DFS(c , u);
            }
        }
    };
    DFS(0 , -1);
    for(int i = 0 ; i < N ; ++i){
        MessageBoard(i , (X >> id[i]) & 1);
    }
}
#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
    const static int maxn = 1e4 + 5;
    static int lab[maxn];
    static int nTime = 0;
    static int id[maxn];
    static long long res = 0;
    static long long cal = 0;
    vector<int> adj[maxn];
    fill_n(lab,maxn,-1);
    function<int(int)> FindLab = [&](int u){
        return lab[u] < 0 ? u : lab[u] = FindLab(lab[u]);
    };
    for(int i = 0 ; i < M ; ++i){
        int s = FindLab(A[i]);
        int d = FindLab(B[i]);
        if(s != d){
            lab[s] += lab[d];
            lab[d] = s;
            adj[A[i]].push_back(B[i]);
            adj[B[i]].push_back(A[i]);
        }
    }
    function<void(int,int)> DFS = [&](int u , int par){
        id[u] = nTime;
        nTime = (nTime + 1) % 60;
        for(int c : adj[u]){
            if(c != par){
                DFS(c , u);
            }
        }
    };
    DFS(0 , -1);
    function<void(int,int)> DFS1 = [&](int u , int par){
        cal |= (1ll << id[u]);
        if(V)res |= (1ll << id[u]);
        for(int c : adj[u]){
            if(c != par && !((cal >> id[c]) & 1)){
                V = Move(c);
                DFS1(c , u);
                V = Move(u);
            }
        }
    };
    DFS1(P , -1);
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1672 KB Output is correct
2 Correct 5 ms 1396 KB Output is correct
3 Incorrect 5 ms 1276 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 3776 KB Output is correct
2 Incorrect 32 ms 3756 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1460 KB Output is correct
2 Correct 5 ms 1272 KB Output is correct
3 Correct 5 ms 1268 KB Output is correct
4 Correct 7 ms 1960 KB Output is correct
5 Correct 7 ms 1760 KB Output is correct
6 Correct 7 ms 1860 KB Output is correct
7 Correct 7 ms 1824 KB Output is correct
8 Correct 7 ms 1696 KB Output is correct
9 Correct 19 ms 4248 KB Output is correct
10 Correct 18 ms 4256 KB Output is correct
11 Correct 17 ms 4180 KB Output is correct
12 Correct 5 ms 1268 KB Output is correct
13 Correct 5 ms 1528 KB Output is correct
14 Correct 4 ms 1396 KB Output is correct
15 Correct 4 ms 1396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 3712 KB Output is correct
2 Correct 31 ms 3728 KB Output is correct
3 Correct 31 ms 3712 KB Output is correct
4 Correct 22 ms 2968 KB Output is correct
5 Correct 22 ms 3872 KB Output is correct
6 Correct 22 ms 3480 KB Output is correct
7 Incorrect 22 ms 3480 KB Wrong Answer [7]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 3712 KB Output is correct
2 Correct 31 ms 3728 KB Output is correct
3 Correct 32 ms 3712 KB Output is correct
4 Correct 20 ms 3164 KB Output is correct
5 Correct 27 ms 3996 KB Output is correct
6 Correct 22 ms 3440 KB Output is correct
7 Correct 22 ms 3224 KB Output is correct
8 Correct 22 ms 3360 KB Output is correct
9 Correct 20 ms 3352 KB Output is correct
10 Correct 19 ms 3100 KB Output is correct
11 Correct 19 ms 3100 KB Output is correct
12 Correct 19 ms 2944 KB Output is correct
13 Incorrect 19 ms 2944 KB Wrong Answer [7]
14 Halted 0 ms 0 KB -