답안 #57625

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57625 2018-07-15T13:56:19 Z hamzqq9 Amusement Park (JOI17_amusement_park) C++14
80 / 100
59 ms 19168 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(0);

}
#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(0,-1);

	solve();

	return X;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2144 KB Output is correct
2 Correct 6 ms 2928 KB Output is correct
3 Correct 6 ms 3088 KB Output is correct
4 Correct 6 ms 3200 KB Output is correct
5 Correct 5 ms 3312 KB Output is correct
6 Correct 8 ms 3312 KB Output is correct
7 Correct 6 ms 3312 KB Output is correct
8 Correct 7 ms 3312 KB Output is correct
9 Correct 8 ms 3320 KB Output is correct
10 Correct 7 ms 3328 KB Output is correct
11 Correct 9 ms 3532 KB Output is correct
12 Correct 7 ms 3736 KB Output is correct
13 Correct 6 ms 3736 KB Output is correct
14 Correct 9 ms 3736 KB Output is correct
15 Correct 7 ms 3736 KB Output is correct
16 Correct 8 ms 3736 KB Output is correct
17 Correct 8 ms 3736 KB Output is correct
18 Correct 6 ms 3736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 5924 KB Output is correct
2 Correct 52 ms 6888 KB Output is correct
3 Correct 45 ms 7080 KB Output is correct
4 Correct 28 ms 7272 KB Output is correct
5 Correct 28 ms 7272 KB Output is correct
6 Correct 25 ms 7272 KB Output is correct
7 Correct 28 ms 7272 KB Output is correct
8 Correct 27 ms 7272 KB Output is correct
9 Correct 24 ms 7344 KB Output is correct
10 Correct 19 ms 7416 KB Output is correct
11 Correct 19 ms 7416 KB Output is correct
12 Correct 43 ms 7416 KB Output is correct
13 Correct 27 ms 7520 KB Output is correct
14 Correct 27 ms 7744 KB Output is correct
15 Correct 37 ms 8076 KB Output is correct
16 Correct 24 ms 8500 KB Output is correct
17 Correct 36 ms 8712 KB Output is correct
18 Correct 23 ms 8768 KB Output is correct
19 Correct 20 ms 9020 KB Output is correct
20 Correct 22 ms 9360 KB Output is correct
21 Correct 23 ms 9704 KB Output is correct
22 Correct 30 ms 9904 KB Output is correct
23 Correct 24 ms 9992 KB Output is correct
24 Correct 36 ms 10080 KB Output is correct
25 Correct 39 ms 10148 KB Output is correct
26 Correct 28 ms 10440 KB Output is correct
27 Correct 31 ms 10740 KB Output is correct
28 Correct 23 ms 10912 KB Output is correct
29 Correct 22 ms 11008 KB Output is correct
30 Correct 29 ms 11056 KB Output is correct
31 Correct 5 ms 11104 KB Output is correct
32 Correct 6 ms 11104 KB Output is correct
33 Correct 5 ms 11104 KB Output is correct
34 Correct 7 ms 11104 KB Output is correct
35 Correct 6 ms 11104 KB Output is correct
36 Correct 7 ms 11104 KB Output is correct
37 Correct 6 ms 11104 KB Output is correct
38 Correct 8 ms 11104 KB Output is correct
39 Correct 7 ms 11104 KB Output is correct
40 Correct 8 ms 11104 KB Output is correct
41 Correct 6 ms 11104 KB Output is correct
42 Correct 8 ms 11104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 11104 KB Output is correct
2 Correct 6 ms 11104 KB Output is correct
3 Correct 7 ms 11104 KB Output is correct
4 Correct 8 ms 11104 KB Output is correct
5 Correct 10 ms 11104 KB Output is correct
6 Correct 9 ms 11104 KB Output is correct
7 Correct 7 ms 11104 KB Output is correct
8 Correct 16 ms 11104 KB Output is correct
9 Correct 26 ms 11788 KB Output is correct
10 Correct 19 ms 12568 KB Output is correct
11 Correct 22 ms 12760 KB Output is correct
12 Correct 5 ms 12856 KB Output is correct
13 Correct 6 ms 12856 KB Output is correct
14 Correct 6 ms 12856 KB Output is correct
15 Correct 6 ms 12856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 12884 KB Output is correct
2 Correct 43 ms 12920 KB Output is correct
3 Correct 45 ms 13276 KB Output is correct
4 Correct 26 ms 13624 KB Output is correct
5 Partially correct 29 ms 13624 KB Partially correct
6 Correct 29 ms 13624 KB Output is correct
7 Correct 29 ms 13624 KB Output is correct
8 Correct 20 ms 13624 KB Output is correct
9 Correct 27 ms 13700 KB Output is correct
10 Correct 23 ms 13776 KB Output is correct
11 Correct 24 ms 13896 KB Output is correct
12 Correct 23 ms 14016 KB Output is correct
13 Correct 23 ms 14016 KB Output is correct
14 Correct 22 ms 14096 KB Output is correct
15 Correct 32 ms 14392 KB Output is correct
16 Correct 37 ms 14720 KB Output is correct
17 Correct 28 ms 14892 KB Output is correct
18 Partially correct 27 ms 14956 KB Partially correct
19 Correct 28 ms 15160 KB Output is correct
20 Correct 27 ms 15608 KB Output is correct
21 Correct 18 ms 15952 KB Output is correct
22 Correct 32 ms 16144 KB Output is correct
23 Correct 24 ms 16240 KB Output is correct
24 Correct 28 ms 16304 KB Output is correct
25 Correct 30 ms 16632 KB Output is correct
26 Correct 23 ms 16952 KB Output is correct
27 Correct 25 ms 17200 KB Output is correct
28 Correct 23 ms 17392 KB Output is correct
29 Correct 28 ms 17416 KB Output is correct
30 Correct 31 ms 17460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 18136 KB Output is correct
2 Correct 33 ms 18792 KB Output is correct
3 Correct 59 ms 18980 KB Output is correct
4 Correct 25 ms 19168 KB Output is correct
5 Incorrect 28 ms 19168 KB Output isn't correct
6 Halted 0 ms 0 KB -