답안 #246049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
246049 2020-07-08T05:37:34 Z kshitij_sodani Amusement Park (JOI17_amusement_park) C++14
80 / 100
196 ms 4404 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#include "Joi.h"
int par[10001];
int find(int no){
	if(par[no]==no){
		return no;
	}
	no=find(par[no]);
	return no;
}
vector<int> adj2[10001];
long long xx;
long long co=0;
void dfs3(int no,int par2=-1){
	if(((xx)&((llo)((llo)1<<co)))){
		MessageBoard(no,1);
	}
	else{
		MessageBoard(no,0);
	}
	co=(co+1)%60;
	for(auto j:adj2[no]){
		if(j==par2){
			continue;
		}
		dfs3(j,no);
	}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
	xx=X;
	for(int i=0;i<N;i++){
		par[i]=i;
	}
	for(int i=0;i<M;i++){
		int x=find(A[i]);
		int y=find(B[i]);
		if(x!=y){
			par[x]=y;
			adj2[A[i]].pb(B[i]);
			adj2[B[i]].pb(A[i]);
		}
	}
	dfs3(0);
}
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#include "Ioi.h"
vector<int> adj[10001];
int par3[10001];
int find5(int no){
	if(par3[no]==no){
		return no;
	}
	no=find5(par3[no]);
	return no;
}
int ss[10001];
int par4[10001];
int cur[10001];
int co2=0;
void dfs2(int no,int par2=-1){
	cur[no]=co2;
	co2=(co2+1)%60;
	par4[no]=par2;
	ss[no]=1;
	for(auto j:adj[no]){
		if(j==par2){
			continue;
		}
		dfs2(j,no);
		ss[no]+=ss[j];
	}
}
long long ans=0;
int cop=0;
multiset<int> kk;
void dfs(int no,int par2=-1){
	cop+=1;
	if(kk.find(cur[no])!=kk.end()){
		while(true){
			continue;
		}
	}
	kk.insert(cur[no]);

	for(auto j:adj[no]){
		if(j==par4[no]){
			continue;
		}
		if(cop<60){
			long long x=Move(j);
			ans+=((llo)((llo)1<<cur[j]))*x;
			dfs(j);
			int y=Move(no);
		}
	}

}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	for(int i=0;i<N;i++){
		par3[i]=i;
	}
	for(int i=0;i<M;i++){
		int x=find5(A[i]);
		int y=find5(B[i]);
		if(x!=y){
			par3[x]=y;
			adj[A[i]].pb(B[i]);
			adj[B[i]].pb(A[i]);
		}
	}
	dfs2(0);
	int cot=P;
	long long val=V;

	while(ss[cot]<60){

		cot=par4[cot];

		val=Move(cot);
	}
	ans+=((llo)((llo)1<<cur[cot]))*val;

	dfs(cot);
	if(kk.size()!=60){
		while(true){
			continue;
		}
	}
//	cout<<((llo)((llo)1<<60))<<endl;
	/*if(kol!=cot){
		while(true){
			continue;
		}
	}*/
	//cout<<kk.size()<<endl;

	return ans;
}

/*
g++ -std=c++14 -O2 -o aa grader.cpp Joi.cpp Ioi.cpp
*/

Compilation message

Ioi.cpp: In function 'void dfs(int, int)':
Ioi.cpp:55:8: warning: unused variable 'y' [-Wunused-variable]
    int y=Move(no);
        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1284 KB Output is correct
2 Correct 10 ms 1288 KB Output is correct
3 Correct 10 ms 1540 KB Output is correct
4 Correct 10 ms 1416 KB Output is correct
5 Correct 10 ms 1524 KB Output is correct
6 Correct 10 ms 1288 KB Output is correct
7 Correct 10 ms 1540 KB Output is correct
8 Correct 10 ms 1540 KB Output is correct
9 Correct 10 ms 1536 KB Output is correct
10 Correct 10 ms 1288 KB Output is correct
11 Correct 14 ms 1748 KB Output is correct
12 Correct 10 ms 1520 KB Output is correct
13 Correct 10 ms 1540 KB Output is correct
14 Correct 10 ms 1548 KB Output is correct
15 Correct 10 ms 1536 KB Output is correct
16 Correct 10 ms 1512 KB Output is correct
17 Correct 10 ms 1524 KB Output is correct
18 Correct 10 ms 1548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 169 ms 3652 KB Output is correct
2 Correct 165 ms 3912 KB Output is correct
3 Correct 161 ms 3820 KB Output is correct
4 Correct 27 ms 3184 KB Output is correct
5 Correct 25 ms 3644 KB Output is correct
6 Correct 25 ms 3428 KB Output is correct
7 Correct 26 ms 3672 KB Output is correct
8 Correct 25 ms 3616 KB Output is correct
9 Correct 25 ms 3752 KB Output is correct
10 Correct 163 ms 3120 KB Output is correct
11 Correct 174 ms 3264 KB Output is correct
12 Correct 23 ms 3088 KB Output is correct
13 Correct 24 ms 2852 KB Output is correct
14 Correct 25 ms 3364 KB Output is correct
15 Correct 30 ms 3584 KB Output is correct
16 Correct 30 ms 3176 KB Output is correct
17 Correct 33 ms 3152 KB Output is correct
18 Correct 27 ms 3176 KB Output is correct
19 Correct 32 ms 3176 KB Output is correct
20 Correct 22 ms 3864 KB Output is correct
21 Correct 20 ms 3732 KB Output is correct
22 Correct 25 ms 3408 KB Output is correct
23 Correct 25 ms 3516 KB Output is correct
24 Correct 26 ms 3444 KB Output is correct
25 Correct 25 ms 3516 KB Output is correct
26 Correct 25 ms 3516 KB Output is correct
27 Correct 24 ms 3528 KB Output is correct
28 Correct 25 ms 3768 KB Output is correct
29 Correct 23 ms 3464 KB Output is correct
30 Correct 24 ms 3440 KB Output is correct
31 Correct 10 ms 1548 KB Output is correct
32 Correct 10 ms 1288 KB Output is correct
33 Correct 10 ms 1532 KB Output is correct
34 Correct 10 ms 1544 KB Output is correct
35 Correct 10 ms 1540 KB Output is correct
36 Correct 10 ms 1288 KB Output is correct
37 Correct 10 ms 1520 KB Output is correct
38 Correct 10 ms 1336 KB Output is correct
39 Correct 10 ms 1540 KB Output is correct
40 Correct 9 ms 1288 KB Output is correct
41 Correct 10 ms 1540 KB Output is correct
42 Correct 10 ms 1288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1512 KB Output is correct
2 Correct 10 ms 1428 KB Output is correct
3 Correct 10 ms 1524 KB Output is correct
4 Correct 12 ms 1732 KB Output is correct
5 Correct 12 ms 1900 KB Output is correct
6 Correct 12 ms 1748 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 11 ms 1908 KB Output is correct
9 Correct 24 ms 4392 KB Output is correct
10 Correct 24 ms 4276 KB Output is correct
11 Correct 23 ms 4404 KB Output is correct
12 Correct 10 ms 1516 KB Output is correct
13 Correct 10 ms 1416 KB Output is correct
14 Correct 10 ms 1412 KB Output is correct
15 Correct 11 ms 1292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 190 ms 3500 KB Partially correct
2 Correct 173 ms 3908 KB Output is correct
3 Partially correct 184 ms 3888 KB Partially correct
4 Correct 28 ms 3152 KB Output is correct
5 Partially correct 27 ms 3900 KB Partially correct
6 Partially correct 25 ms 3644 KB Partially correct
7 Correct 26 ms 3524 KB Output is correct
8 Correct 26 ms 3332 KB Output is correct
9 Correct 26 ms 3436 KB Output is correct
10 Correct 169 ms 3124 KB Output is correct
11 Correct 167 ms 3356 KB Output is correct
12 Correct 26 ms 3104 KB Output is correct
13 Partially correct 24 ms 3104 KB Partially correct
14 Partially correct 25 ms 3208 KB Partially correct
15 Partially correct 30 ms 3132 KB Partially correct
16 Correct 31 ms 3200 KB Output is correct
17 Correct 27 ms 3192 KB Output is correct
18 Partially correct 27 ms 3152 KB Partially correct
19 Partially correct 27 ms 3188 KB Partially correct
20 Correct 23 ms 3568 KB Output is correct
21 Correct 22 ms 3708 KB Output is correct
22 Correct 28 ms 3388 KB Output is correct
23 Correct 25 ms 3424 KB Output is correct
24 Correct 26 ms 3432 KB Output is correct
25 Correct 27 ms 3744 KB Output is correct
26 Correct 27 ms 3528 KB Output is correct
27 Correct 30 ms 3740 KB Output is correct
28 Correct 25 ms 3388 KB Output is correct
29 Correct 26 ms 3472 KB Output is correct
30 Correct 28 ms 3704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 3736 KB Output is correct
2 Correct 173 ms 3912 KB Output is correct
3 Incorrect 189 ms 3972 KB Output isn't correct
4 Halted 0 ms 0 KB -