답안 #246050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
246050 2020-07-08T05:45:17 Z kshitij_sodani Amusement Park (JOI17_amusement_park) C++14
80 / 100
182 ms 4148 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);
			if(cop<60){
				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:56:9: 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 1420 KB Output is correct
3 Correct 10 ms 1292 KB Output is correct
4 Correct 10 ms 1520 KB Output is correct
5 Correct 10 ms 1384 KB Output is correct
6 Correct 10 ms 1296 KB Output is correct
7 Correct 10 ms 1544 KB Output is correct
8 Correct 10 ms 1536 KB Output is correct
9 Correct 10 ms 1540 KB Output is correct
10 Correct 10 ms 1416 KB Output is correct
11 Correct 14 ms 1480 KB Output is correct
12 Correct 10 ms 1292 KB Output is correct
13 Correct 10 ms 1540 KB Output is correct
14 Correct 10 ms 1512 KB Output is correct
15 Correct 10 ms 1292 KB Output is correct
16 Correct 10 ms 1540 KB Output is correct
17 Correct 10 ms 1536 KB Output is correct
18 Correct 10 ms 1532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 175 ms 3656 KB Output is correct
2 Correct 168 ms 3676 KB Output is correct
3 Correct 176 ms 3540 KB Output is correct
4 Correct 27 ms 2920 KB Output is correct
5 Correct 24 ms 3412 KB Output is correct
6 Correct 25 ms 3428 KB Output is correct
7 Correct 25 ms 3164 KB Output is correct
8 Correct 27 ms 3404 KB Output is correct
9 Correct 25 ms 3404 KB Output is correct
10 Correct 169 ms 3100 KB Output is correct
11 Correct 170 ms 2876 KB Output is correct
12 Correct 23 ms 2844 KB Output is correct
13 Correct 24 ms 2848 KB Output is correct
14 Correct 26 ms 2952 KB Output is correct
15 Correct 30 ms 2908 KB Output is correct
16 Correct 28 ms 2892 KB Output is correct
17 Correct 26 ms 2932 KB Output is correct
18 Correct 27 ms 2920 KB Output is correct
19 Correct 27 ms 3068 KB Output is correct
20 Correct 20 ms 3480 KB Output is correct
21 Correct 20 ms 3532 KB Output is correct
22 Correct 25 ms 3148 KB Output is correct
23 Correct 25 ms 3528 KB Output is correct
24 Correct 25 ms 3020 KB Output is correct
25 Correct 25 ms 3156 KB Output is correct
26 Correct 26 ms 3360 KB Output is correct
27 Correct 26 ms 3524 KB Output is correct
28 Correct 25 ms 3488 KB Output is correct
29 Correct 27 ms 3220 KB Output is correct
30 Correct 24 ms 3160 KB Output is correct
31 Correct 10 ms 1516 KB Output is correct
32 Correct 10 ms 1296 KB Output is correct
33 Correct 11 ms 1392 KB Output is correct
34 Correct 10 ms 1464 KB Output is correct
35 Correct 9 ms 1544 KB Output is correct
36 Correct 10 ms 1520 KB Output is correct
37 Correct 10 ms 1296 KB Output is correct
38 Correct 10 ms 1528 KB Output is correct
39 Correct 10 ms 1420 KB Output is correct
40 Correct 9 ms 1536 KB Output is correct
41 Correct 10 ms 1288 KB Output is correct
42 Correct 10 ms 1412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1512 KB Output is correct
2 Correct 9 ms 1388 KB Output is correct
3 Correct 10 ms 1536 KB Output is correct
4 Correct 12 ms 1904 KB Output is correct
5 Correct 11 ms 1748 KB Output is correct
6 Correct 12 ms 1772 KB Output is correct
7 Correct 12 ms 1912 KB Output is correct
8 Correct 12 ms 1880 KB Output is correct
9 Correct 24 ms 3988 KB Output is correct
10 Correct 27 ms 3992 KB Output is correct
11 Correct 20 ms 4148 KB Output is correct
12 Correct 10 ms 1536 KB Output is correct
13 Correct 10 ms 1284 KB Output is correct
14 Correct 9 ms 1296 KB Output is correct
15 Correct 9 ms 1392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 174 ms 3440 KB Output is correct
2 Correct 170 ms 3784 KB Output is correct
3 Partially correct 173 ms 3656 KB Partially correct
4 Correct 26 ms 2928 KB Output is correct
5 Partially correct 24 ms 3784 KB Partially correct
6 Correct 25 ms 3512 KB Output is correct
7 Correct 26 ms 3276 KB Output is correct
8 Correct 25 ms 3020 KB Output is correct
9 Correct 26 ms 3192 KB Output is correct
10 Correct 163 ms 3024 KB Output is correct
11 Correct 176 ms 3128 KB Output is correct
12 Correct 23 ms 2860 KB Output is correct
13 Correct 24 ms 2848 KB Output is correct
14 Correct 25 ms 2956 KB Output is correct
15 Correct 31 ms 2892 KB Output is correct
16 Correct 30 ms 2920 KB Output is correct
17 Correct 32 ms 2924 KB Output is correct
18 Partially correct 27 ms 2892 KB Partially correct
19 Correct 25 ms 2636 KB Output is correct
20 Correct 22 ms 3472 KB Output is correct
21 Correct 20 ms 3480 KB Output is correct
22 Correct 25 ms 3536 KB Output is correct
23 Correct 25 ms 3156 KB Output is correct
24 Correct 24 ms 3180 KB Output is correct
25 Correct 25 ms 3496 KB Output is correct
26 Correct 26 ms 3376 KB Output is correct
27 Correct 25 ms 3404 KB Output is correct
28 Correct 25 ms 3168 KB Output is correct
29 Correct 28 ms 3220 KB Output is correct
30 Correct 25 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 182 ms 3504 KB Output is correct
2 Correct 167 ms 3492 KB Output is correct
3 Incorrect 167 ms 3700 KB Output isn't correct
4 Halted 0 ms 0 KB -