답안 #57627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57627 2018-07-15T13:59:58 Z hamzqq9 Amusement Park (JOI17_amusement_park) C++14
80 / 100
50 ms 6696 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],vis[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) {

	vis[node]=true;

	beg[node]=Time++;

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

	for(int i:v[node]) {

		if(vis[i]) continue ;

		dfs(i);

	}

}

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(31);

}
#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],v2[MAX];
static bool vis[MAX];

static void dfs2(int node) {

	total++;

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

	for(int i:v2[node]) {

		if(total==60) continue ;

		V=Move(i);

		dfs2(i);

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

	}

}

static void solve() {

	while(1) {

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

		P=Par[P];

		V=Move(P);
	
	}

	dfs2(P);

}

static void dfs(int node,int ata) {

	vis[node]=true;

	sub[node]=1;

	beg[node]=Time++;

	Par[node]=ata;

	if(~ata) v2[ata].pb(node);

	for(int i:v[node]) {

		if(vis[i]) 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(31,-1);

	solve();

	return X;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2276 KB Output is correct
2 Correct 7 ms 2992 KB Output is correct
3 Correct 7 ms 3208 KB Output is correct
4 Correct 7 ms 3208 KB Output is correct
5 Correct 7 ms 3208 KB Output is correct
6 Correct 10 ms 3208 KB Output is correct
7 Correct 6 ms 3208 KB Output is correct
8 Correct 8 ms 3208 KB Output is correct
9 Correct 7 ms 3260 KB Output is correct
10 Correct 7 ms 3312 KB Output is correct
11 Correct 11 ms 3352 KB Output is correct
12 Correct 6 ms 3392 KB Output is correct
13 Correct 7 ms 3392 KB Output is correct
14 Correct 7 ms 3392 KB Output is correct
15 Correct 7 ms 3392 KB Output is correct
16 Correct 8 ms 3392 KB Output is correct
17 Correct 6 ms 3392 KB Output is correct
18 Correct 6 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 5640 KB Output is correct
2 Correct 36 ms 6604 KB Output is correct
3 Correct 49 ms 6664 KB Output is correct
4 Correct 27 ms 6664 KB Output is correct
5 Correct 25 ms 6664 KB Output is correct
6 Correct 30 ms 6664 KB Output is correct
7 Correct 38 ms 6664 KB Output is correct
8 Correct 32 ms 6664 KB Output is correct
9 Correct 30 ms 6664 KB Output is correct
10 Correct 30 ms 6664 KB Output is correct
11 Correct 25 ms 6664 KB Output is correct
12 Correct 25 ms 6664 KB Output is correct
13 Correct 22 ms 6664 KB Output is correct
14 Correct 23 ms 6664 KB Output is correct
15 Correct 23 ms 6664 KB Output is correct
16 Correct 20 ms 6664 KB Output is correct
17 Correct 33 ms 6664 KB Output is correct
18 Correct 32 ms 6664 KB Output is correct
19 Correct 28 ms 6664 KB Output is correct
20 Correct 28 ms 6664 KB Output is correct
21 Correct 20 ms 6664 KB Output is correct
22 Correct 32 ms 6664 KB Output is correct
23 Correct 38 ms 6664 KB Output is correct
24 Correct 28 ms 6664 KB Output is correct
25 Correct 30 ms 6664 KB Output is correct
26 Correct 35 ms 6664 KB Output is correct
27 Correct 23 ms 6664 KB Output is correct
28 Correct 24 ms 6664 KB Output is correct
29 Correct 27 ms 6664 KB Output is correct
30 Correct 28 ms 6664 KB Output is correct
31 Correct 8 ms 6664 KB Output is correct
32 Correct 8 ms 6664 KB Output is correct
33 Correct 6 ms 6664 KB Output is correct
34 Correct 7 ms 6664 KB Output is correct
35 Correct 6 ms 6664 KB Output is correct
36 Correct 5 ms 6664 KB Output is correct
37 Correct 7 ms 6664 KB Output is correct
38 Correct 6 ms 6664 KB Output is correct
39 Correct 5 ms 6664 KB Output is correct
40 Correct 8 ms 6664 KB Output is correct
41 Correct 6 ms 6664 KB Output is correct
42 Correct 6 ms 6664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 6664 KB Output is correct
2 Correct 6 ms 6664 KB Output is correct
3 Correct 7 ms 6664 KB Output is correct
4 Correct 9 ms 6664 KB Output is correct
5 Correct 11 ms 6664 KB Output is correct
6 Correct 11 ms 6664 KB Output is correct
7 Correct 9 ms 6664 KB Output is correct
8 Correct 10 ms 6664 KB Output is correct
9 Correct 26 ms 6664 KB Output is correct
10 Correct 22 ms 6664 KB Output is correct
11 Correct 23 ms 6664 KB Output is correct
12 Correct 6 ms 6664 KB Output is correct
13 Correct 6 ms 6664 KB Output is correct
14 Correct 7 ms 6664 KB Output is correct
15 Correct 6 ms 6664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 6664 KB Output is correct
2 Correct 44 ms 6668 KB Output is correct
3 Correct 48 ms 6684 KB Output is correct
4 Correct 28 ms 6696 KB Output is correct
5 Partially correct 38 ms 6696 KB Partially correct
6 Correct 29 ms 6696 KB Output is correct
7 Correct 30 ms 6696 KB Output is correct
8 Correct 47 ms 6696 KB Output is correct
9 Correct 26 ms 6696 KB Output is correct
10 Correct 23 ms 6696 KB Output is correct
11 Correct 23 ms 6696 KB Output is correct
12 Correct 22 ms 6696 KB Output is correct
13 Correct 27 ms 6696 KB Output is correct
14 Correct 33 ms 6696 KB Output is correct
15 Correct 44 ms 6696 KB Output is correct
16 Correct 23 ms 6696 KB Output is correct
17 Correct 23 ms 6696 KB Output is correct
18 Partially correct 24 ms 6696 KB Partially correct
19 Correct 25 ms 6696 KB Output is correct
20 Correct 22 ms 6696 KB Output is correct
21 Correct 26 ms 6696 KB Output is correct
22 Correct 40 ms 6696 KB Output is correct
23 Correct 26 ms 6696 KB Output is correct
24 Correct 22 ms 6696 KB Output is correct
25 Correct 23 ms 6696 KB Output is correct
26 Correct 28 ms 6696 KB Output is correct
27 Correct 28 ms 6696 KB Output is correct
28 Correct 24 ms 6696 KB Output is correct
29 Correct 23 ms 6696 KB Output is correct
30 Correct 30 ms 6696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 6696 KB Output is correct
2 Correct 40 ms 6696 KB Output is correct
3 Correct 50 ms 6696 KB Output is correct
4 Correct 24 ms 6696 KB Output is correct
5 Incorrect 26 ms 6696 KB Output isn't correct
6 Halted 0 ms 0 KB -