답안 #57621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57621 2018-07-15T13:26:47 Z hamzqq9 Amusement Park (JOI17_amusement_park) C++14
0 / 100
17 ms 5112 KB
#include "Joi.h"
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define st first
#define nd second
#define pb push_back
#define MAX 20005
#define sz(x) ((int)x.size())
#define pw(x) (1LL<<(x))
 
static int Time;
static int beg[MAX];
static bool Bit[MAX];
static vector<int> v[MAX];

static void createbits(ll x) {

	for(int i=0;i<60;i++) Bit[i]=((x>>i)&1);

}

static void dfs(int node,int ata) {

	beg[node]=Time++;

	MessageBoard(node,Bit[beg[node]%60]);

	for(int i:v[node]) {

		if(i==ata) continue ;

		dfs(i,node);

	}

}

void Joi(int N, int M, int A[], int B[], long long X, int T) {
  	
	createbits(X);

	for(int i=0;i<M;i++) {

		v[A[i]].pb(B[i]);
		v[B[i]].pb(A[i]);

	}

	dfs(0,-1);

}
#include "Ioi.h"
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define st first
#define nd second
#define pb push_back
#define MAX 20005
#define sz(x) ((int) x.size())
#define pw(x) (1LL<<(x))
 
static int sub[MAX],Par[MAX],beg[MAX];
static int Time,total,V,P;
static ll X;
static vector<int> v[MAX];

static void dfs2(int node,int ata) {

	if(total==60) return ;

	X|=V*pw(beg[node]%60);

	for(int i:v[node]) {

		if(i==ata || total==60) continue ;

		total++;

		V=Move(i);

		dfs2(i,node);

		if(total<60) V=Move(node);

	}

}

static void solve() {

	total=1;

	while(1) {

		if(sub[P]>=60) break ;

		P=Par[P];

		V=Move(P);
	
	}

	dfs2(P,Par[P]);

}

static void dfs(int node,int ata) {

	sub[node]=1;

	beg[node]=Time++;

	Par[node]=ata;

	for(int i:v[node]) {

		if(i==ata) continue ;

		dfs(i,node);

		sub[node]+=sub[i];

	}

}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
  
	for(int i=0;i<M;i++) {

		v[A[i]].pb(B[i]);
		v[B[i]].pb(A[i]);

	}

	::P=P;
	::V=V;

	dfs(0,-1);

	solve();

	return X;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 1764 KB Output is correct
2 Incorrect 6 ms 2008 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 3816 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3816 KB Output is correct
2 Correct 5 ms 3816 KB Output is correct
3 Correct 6 ms 3816 KB Output is correct
4 Correct 10 ms 3816 KB Output is correct
5 Correct 10 ms 3816 KB Output is correct
6 Correct 7 ms 3816 KB Output is correct
7 Incorrect 8 ms 3816 KB Wrong Answer [7]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 4720 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 5112 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -