답안 #843829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
843829 2023-09-04T15:36:00 Z denniskim 참나무 (IOI23_beechtree) C++17
100 / 100
195 ms 96532 KB
#include "beechtree.h"
#include <bits/stdc++.h>

using namespace std;
typedef int ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

vector<ll> zip;
vector<ll> vec[200010];
ll chk[200010];
ll siz[200010];
map<ll, ll> mp[200010];
map<ll, ll> st[200010];
ll bun[200010];
ll ans[200010];

void dfs0(ll here, ll pa)
{
	siz[here] = 1;
	
	for(auto &i : vec[here])
	{
		dfs0(i, here);
		siz[here] += siz[i];
	}
}

void dfs(ll here, ll pa)
{
	if((ll)vec[here].size() == 0)
	{
		mp[here][siz[here]] = here;
		bun[here] = here;
		return;
	}
	
	for(auto &i : vec[here])
	{
		dfs(i, here);
		
		if(ans[i] == -1)
			ans[here] = -1;
	}
	
	if(ans[here] == -1)
		return;
	
	ll maxx = -1;
	ll w = -1;
	
	for(auto &i : vec[here])
	{
		if(maxx < siz[i])
		{
			maxx = siz[i];
			w = i;
		}
	}
	
	bun[here] = bun[w];
	
	for(auto &i : vec[here])
	{
		if(i == w)
			continue;
		
		for(auto &j : mp[bun[i]])
		{
			if(j.fi == 1)
				continue;
			
			auto p = mp[bun[here]].lower_bound(j.fi);
			
			if(p != mp[bun[here]].end())
			{
				auto gap = (*p);
				ll V = gap.se;
				ll U = j.se;
				
				for(auto &k : st[U])
				{
					if(st[V].find(k.fi) == st[V].end())
					{
						ans[here] = -1;
						return;
					}
					
					if(siz[st[V][k.fi]] < siz[k.se])
					{
						ans[here] = -1;
						return;
					}
				}
				
				if(gap.fi == j.fi)
				{
					for(auto &k : st[V])
					{
						if(st[U].find(k.fi) == st[U].end())
						{
							ans[here] = -1;
							return;
						}
						
						if(siz[st[U][k.fi]] < siz[k.se])
						{
							ans[here] = -1;
							return;
						}
					}
				}
			}
			
			p = mp[bun[here]].upper_bound(j.fi);
			
			if(p != mp[bun[here]].begin())
			{
				p--;
				auto gap = (*p);
				ll V = gap.se;
				ll U = j.se;
				
				for(auto &k : st[V])
				{
					if(st[U].find(k.fi) == st[U].end())
					{
						ans[here] = -1;
						return;
					}
					
					if(siz[st[U][k.fi]] < siz[k.se])
					{
						ans[here] = -1;
						return;
					}
				}
			}
		}
		
		for(auto &j : mp[bun[i]])
			mp[bun[here]][j.fi] = j.se;
	}
	
	auto p = mp[bun[here]].rbegin();
	auto gap = (*p);
	ll V = gap.se;
	ll U = here;
	
	for(auto &k : st[V])
	{
		if(st[U].find(k.fi) == st[U].end())
		{
			ans[here] = -1;
			return;
		}
		
		if(siz[st[U][k.fi]] < siz[k.se])
		{
			ans[here] = -1;
			return;
		}
	}
	
	if(gap.fi == siz[here])
	{
		for(auto &k : st[V])
		{
			if(st[U].find(k.fi) == st[U].end())
			{
				ans[here] = -1;
				return;
			}
			
			if(siz[st[U][k.fi]] < siz[k.se])
			{
				ans[here] = -1;
				return;
			}
		}
	}
	
	mp[bun[here]][siz[here]] = here;
}

vector<ll> beechtree(ll N, ll M, vector<ll> P, vector<ll> C)
{
	for(ll i = 1 ; i < N ; i++)
		zip.push_back(C[i]);
	
	compress(zip);
	
	M = (ll)zip.size();
	
	for(ll i = 1 ; i < N ; i++)
		C[i] = lower_bound(zip.begin(), zip.end(), C[i]) - zip.begin() + 1;
	
	for(ll i = 1 ; i < N ; i++)
		vec[P[i]].push_back(i);
	
	for(ll i = 0 ; i < N ; i++)
	{
		set<ll> st22;
		
		for(auto &j : vec[i])
			st22.insert(C[j]);
		
		if((ll)st22.size() != (ll)vec[i].size())
			ans[i] = -1;
	}
	
	dfs0(0, -1);
	
	for(ll i = 0 ; i < N ; i++)
	{
		for(auto &j : vec[i])
			st[i][C[j]] = j;
	}
	
	dfs(0, -1);
	
	vector<ll> anss;
	
	for(ll i = 0 ; i < N ; i++)
	{
		if(ans[i] == -1)
			anss.push_back(0);
		else
			anss.push_back(1);
	}
	
	return anss;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26840 KB Output is correct
3 Correct 6 ms 26712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26852 KB Output is correct
3 Correct 6 ms 26848 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26716 KB Output is correct
6 Correct 6 ms 26716 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 6 ms 26716 KB Output is correct
9 Correct 6 ms 26712 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 5 ms 26716 KB Output is correct
12 Correct 6 ms 26716 KB Output is correct
13 Correct 5 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 5 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 6 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 5 ms 26716 KB Output is correct
20 Correct 5 ms 26716 KB Output is correct
21 Correct 6 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 6 ms 26712 KB Output is correct
24 Correct 5 ms 26716 KB Output is correct
25 Correct 5 ms 26716 KB Output is correct
26 Correct 5 ms 26716 KB Output is correct
27 Correct 5 ms 26844 KB Output is correct
28 Correct 6 ms 26860 KB Output is correct
29 Correct 6 ms 26716 KB Output is correct
30 Correct 5 ms 26724 KB Output is correct
31 Correct 6 ms 26716 KB Output is correct
32 Correct 6 ms 26720 KB Output is correct
33 Correct 5 ms 26716 KB Output is correct
34 Correct 5 ms 26716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26852 KB Output is correct
3 Correct 6 ms 26848 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26716 KB Output is correct
6 Correct 6 ms 26716 KB Output is correct
7 Correct 147 ms 85696 KB Output is correct
8 Correct 139 ms 85708 KB Output is correct
9 Correct 6 ms 26712 KB Output is correct
10 Correct 5 ms 26720 KB Output is correct
11 Correct 6 ms 26864 KB Output is correct
12 Correct 6 ms 26716 KB Output is correct
13 Correct 7 ms 27492 KB Output is correct
14 Correct 7 ms 27484 KB Output is correct
15 Correct 7 ms 27372 KB Output is correct
16 Correct 7 ms 27228 KB Output is correct
17 Correct 145 ms 94812 KB Output is correct
18 Correct 133 ms 91788 KB Output is correct
19 Correct 135 ms 87200 KB Output is correct
20 Correct 143 ms 85708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26716 KB Output is correct
3 Correct 5 ms 26716 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26716 KB Output is correct
6 Correct 6 ms 26968 KB Output is correct
7 Correct 6 ms 26716 KB Output is correct
8 Correct 6 ms 26716 KB Output is correct
9 Correct 6 ms 26716 KB Output is correct
10 Correct 7 ms 26716 KB Output is correct
11 Correct 6 ms 26968 KB Output is correct
12 Correct 6 ms 26972 KB Output is correct
13 Correct 7 ms 26972 KB Output is correct
14 Correct 6 ms 26852 KB Output is correct
15 Correct 96 ms 40044 KB Output is correct
16 Correct 91 ms 39112 KB Output is correct
17 Correct 93 ms 39436 KB Output is correct
18 Correct 98 ms 39712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26852 KB Output is correct
3 Correct 5 ms 26716 KB Output is correct
4 Correct 6 ms 26716 KB Output is correct
5 Correct 147 ms 85696 KB Output is correct
6 Correct 139 ms 85708 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 6 ms 26716 KB Output is correct
9 Correct 7 ms 26972 KB Output is correct
10 Correct 8 ms 26900 KB Output is correct
11 Correct 138 ms 56364 KB Output is correct
12 Correct 179 ms 52356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26840 KB Output is correct
3 Correct 6 ms 26712 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26852 KB Output is correct
6 Correct 6 ms 26848 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 5 ms 26716 KB Output is correct
9 Correct 6 ms 26716 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 6 ms 26716 KB Output is correct
12 Correct 6 ms 26712 KB Output is correct
13 Correct 5 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 6 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 5 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 5 ms 26716 KB Output is correct
20 Correct 6 ms 26716 KB Output is correct
21 Correct 5 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 5 ms 26716 KB Output is correct
24 Correct 6 ms 26716 KB Output is correct
25 Correct 5 ms 26716 KB Output is correct
26 Correct 6 ms 26712 KB Output is correct
27 Correct 5 ms 26716 KB Output is correct
28 Correct 5 ms 26716 KB Output is correct
29 Correct 5 ms 26716 KB Output is correct
30 Correct 5 ms 26844 KB Output is correct
31 Correct 6 ms 26860 KB Output is correct
32 Correct 6 ms 26716 KB Output is correct
33 Correct 5 ms 26724 KB Output is correct
34 Correct 6 ms 26716 KB Output is correct
35 Correct 6 ms 26720 KB Output is correct
36 Correct 5 ms 26716 KB Output is correct
37 Correct 5 ms 26716 KB Output is correct
38 Correct 6 ms 26712 KB Output is correct
39 Correct 5 ms 26720 KB Output is correct
40 Correct 6 ms 26864 KB Output is correct
41 Correct 6 ms 26716 KB Output is correct
42 Correct 5 ms 26716 KB Output is correct
43 Correct 5 ms 26716 KB Output is correct
44 Correct 5 ms 26716 KB Output is correct
45 Correct 5 ms 26716 KB Output is correct
46 Correct 5 ms 26716 KB Output is correct
47 Correct 6 ms 26968 KB Output is correct
48 Correct 6 ms 26716 KB Output is correct
49 Correct 6 ms 26716 KB Output is correct
50 Correct 6 ms 26716 KB Output is correct
51 Correct 7 ms 26716 KB Output is correct
52 Correct 5 ms 26716 KB Output is correct
53 Correct 6 ms 26716 KB Output is correct
54 Correct 5 ms 26716 KB Output is correct
55 Correct 6 ms 26716 KB Output is correct
56 Correct 6 ms 26716 KB Output is correct
57 Correct 6 ms 26716 KB Output is correct
58 Correct 5 ms 26716 KB Output is correct
59 Correct 6 ms 26716 KB Output is correct
60 Correct 6 ms 26716 KB Output is correct
61 Correct 6 ms 26716 KB Output is correct
62 Correct 5 ms 26888 KB Output is correct
63 Correct 7 ms 26716 KB Output is correct
64 Correct 7 ms 26972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26852 KB Output is correct
3 Correct 5 ms 26716 KB Output is correct
4 Correct 6 ms 26716 KB Output is correct
5 Correct 6 ms 26712 KB Output is correct
6 Correct 5 ms 26716 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 6 ms 26716 KB Output is correct
9 Correct 5 ms 26716 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 5 ms 26716 KB Output is correct
12 Correct 5 ms 26716 KB Output is correct
13 Correct 6 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 5 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 6 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 6 ms 26712 KB Output is correct
20 Correct 5 ms 26716 KB Output is correct
21 Correct 5 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 5 ms 26844 KB Output is correct
24 Correct 6 ms 26860 KB Output is correct
25 Correct 8 ms 27484 KB Output is correct
26 Correct 7 ms 27484 KB Output is correct
27 Correct 7 ms 27484 KB Output is correct
28 Correct 6 ms 27228 KB Output is correct
29 Correct 7 ms 27484 KB Output is correct
30 Correct 7 ms 27148 KB Output is correct
31 Correct 7 ms 27144 KB Output is correct
32 Correct 7 ms 26972 KB Output is correct
33 Correct 7 ms 26972 KB Output is correct
34 Correct 6 ms 26960 KB Output is correct
35 Correct 7 ms 26968 KB Output is correct
36 Correct 8 ms 27224 KB Output is correct
37 Correct 7 ms 27228 KB Output is correct
38 Correct 6 ms 27104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26840 KB Output is correct
3 Correct 6 ms 26712 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26852 KB Output is correct
6 Correct 6 ms 26848 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 5 ms 26716 KB Output is correct
9 Correct 6 ms 26716 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 6 ms 26716 KB Output is correct
12 Correct 6 ms 26712 KB Output is correct
13 Correct 5 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 6 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 5 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 5 ms 26716 KB Output is correct
20 Correct 6 ms 26716 KB Output is correct
21 Correct 5 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 5 ms 26716 KB Output is correct
24 Correct 6 ms 26716 KB Output is correct
25 Correct 5 ms 26716 KB Output is correct
26 Correct 6 ms 26712 KB Output is correct
27 Correct 5 ms 26716 KB Output is correct
28 Correct 5 ms 26716 KB Output is correct
29 Correct 5 ms 26716 KB Output is correct
30 Correct 5 ms 26844 KB Output is correct
31 Correct 6 ms 26860 KB Output is correct
32 Correct 6 ms 26716 KB Output is correct
33 Correct 5 ms 26724 KB Output is correct
34 Correct 6 ms 26716 KB Output is correct
35 Correct 6 ms 26720 KB Output is correct
36 Correct 5 ms 26716 KB Output is correct
37 Correct 5 ms 26716 KB Output is correct
38 Correct 6 ms 26712 KB Output is correct
39 Correct 5 ms 26720 KB Output is correct
40 Correct 6 ms 26864 KB Output is correct
41 Correct 6 ms 26716 KB Output is correct
42 Correct 7 ms 27492 KB Output is correct
43 Correct 7 ms 27484 KB Output is correct
44 Correct 7 ms 27372 KB Output is correct
45 Correct 7 ms 27228 KB Output is correct
46 Correct 5 ms 26716 KB Output is correct
47 Correct 5 ms 26716 KB Output is correct
48 Correct 5 ms 26716 KB Output is correct
49 Correct 5 ms 26716 KB Output is correct
50 Correct 5 ms 26716 KB Output is correct
51 Correct 6 ms 26968 KB Output is correct
52 Correct 6 ms 26716 KB Output is correct
53 Correct 6 ms 26716 KB Output is correct
54 Correct 6 ms 26716 KB Output is correct
55 Correct 7 ms 26716 KB Output is correct
56 Correct 6 ms 26968 KB Output is correct
57 Correct 6 ms 26972 KB Output is correct
58 Correct 7 ms 26972 KB Output is correct
59 Correct 6 ms 26852 KB Output is correct
60 Correct 5 ms 26716 KB Output is correct
61 Correct 6 ms 26716 KB Output is correct
62 Correct 7 ms 26972 KB Output is correct
63 Correct 8 ms 26900 KB Output is correct
64 Correct 5 ms 26716 KB Output is correct
65 Correct 6 ms 26716 KB Output is correct
66 Correct 6 ms 26716 KB Output is correct
67 Correct 6 ms 26716 KB Output is correct
68 Correct 5 ms 26716 KB Output is correct
69 Correct 6 ms 26716 KB Output is correct
70 Correct 6 ms 26716 KB Output is correct
71 Correct 6 ms 26716 KB Output is correct
72 Correct 5 ms 26888 KB Output is correct
73 Correct 7 ms 26716 KB Output is correct
74 Correct 7 ms 26972 KB Output is correct
75 Correct 8 ms 27484 KB Output is correct
76 Correct 7 ms 27484 KB Output is correct
77 Correct 7 ms 27484 KB Output is correct
78 Correct 6 ms 27228 KB Output is correct
79 Correct 7 ms 27484 KB Output is correct
80 Correct 7 ms 27148 KB Output is correct
81 Correct 7 ms 27144 KB Output is correct
82 Correct 7 ms 26972 KB Output is correct
83 Correct 7 ms 26972 KB Output is correct
84 Correct 6 ms 26960 KB Output is correct
85 Correct 7 ms 26968 KB Output is correct
86 Correct 8 ms 27224 KB Output is correct
87 Correct 7 ms 27228 KB Output is correct
88 Correct 6 ms 27104 KB Output is correct
89 Correct 7 ms 27228 KB Output is correct
90 Correct 7 ms 27224 KB Output is correct
91 Correct 8 ms 26968 KB Output is correct
92 Correct 7 ms 26972 KB Output is correct
93 Correct 6 ms 27096 KB Output is correct
94 Correct 7 ms 26972 KB Output is correct
95 Correct 8 ms 27152 KB Output is correct
96 Correct 7 ms 27120 KB Output is correct
97 Correct 6 ms 27228 KB Output is correct
98 Correct 7 ms 26968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26852 KB Output is correct
3 Correct 5 ms 26716 KB Output is correct
4 Correct 6 ms 26716 KB Output is correct
5 Correct 6 ms 26712 KB Output is correct
6 Correct 5 ms 26716 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 6 ms 26716 KB Output is correct
9 Correct 5 ms 26716 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 5 ms 26716 KB Output is correct
12 Correct 5 ms 26716 KB Output is correct
13 Correct 6 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 5 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 6 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 6 ms 26712 KB Output is correct
20 Correct 5 ms 26716 KB Output is correct
21 Correct 5 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 5 ms 26844 KB Output is correct
24 Correct 6 ms 26860 KB Output is correct
25 Correct 8 ms 27484 KB Output is correct
26 Correct 7 ms 27484 KB Output is correct
27 Correct 7 ms 27484 KB Output is correct
28 Correct 6 ms 27228 KB Output is correct
29 Correct 7 ms 27484 KB Output is correct
30 Correct 7 ms 27148 KB Output is correct
31 Correct 7 ms 27144 KB Output is correct
32 Correct 7 ms 26972 KB Output is correct
33 Correct 7 ms 26972 KB Output is correct
34 Correct 6 ms 26960 KB Output is correct
35 Correct 7 ms 26968 KB Output is correct
36 Correct 8 ms 27224 KB Output is correct
37 Correct 7 ms 27228 KB Output is correct
38 Correct 6 ms 27104 KB Output is correct
39 Correct 142 ms 96532 KB Output is correct
40 Correct 130 ms 92932 KB Output is correct
41 Correct 126 ms 91520 KB Output is correct
42 Correct 118 ms 87180 KB Output is correct
43 Correct 153 ms 82756 KB Output is correct
44 Correct 126 ms 62464 KB Output is correct
45 Correct 193 ms 58036 KB Output is correct
46 Correct 144 ms 58112 KB Output is correct
47 Correct 143 ms 58620 KB Output is correct
48 Correct 132 ms 58004 KB Output is correct
49 Correct 120 ms 56260 KB Output is correct
50 Correct 166 ms 55960 KB Output is correct
51 Correct 149 ms 56632 KB Output is correct
52 Correct 140 ms 57312 KB Output is correct
53 Correct 133 ms 57396 KB Output is correct
54 Correct 113 ms 54444 KB Output is correct
55 Correct 120 ms 67968 KB Output is correct
56 Correct 114 ms 68552 KB Output is correct
57 Correct 101 ms 55804 KB Output is correct
58 Correct 98 ms 54736 KB Output is correct
59 Correct 97 ms 54768 KB Output is correct
60 Correct 96 ms 54692 KB Output is correct
61 Correct 98 ms 54512 KB Output is correct
62 Correct 99 ms 54520 KB Output is correct
63 Correct 116 ms 64988 KB Output is correct
64 Correct 114 ms 60528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 26716 KB Output is correct
2 Correct 5 ms 26840 KB Output is correct
3 Correct 6 ms 26712 KB Output is correct
4 Correct 5 ms 26716 KB Output is correct
5 Correct 5 ms 26852 KB Output is correct
6 Correct 6 ms 26848 KB Output is correct
7 Correct 5 ms 26716 KB Output is correct
8 Correct 5 ms 26716 KB Output is correct
9 Correct 6 ms 26716 KB Output is correct
10 Correct 5 ms 26716 KB Output is correct
11 Correct 6 ms 26716 KB Output is correct
12 Correct 6 ms 26712 KB Output is correct
13 Correct 5 ms 26716 KB Output is correct
14 Correct 5 ms 26716 KB Output is correct
15 Correct 6 ms 26716 KB Output is correct
16 Correct 5 ms 26716 KB Output is correct
17 Correct 5 ms 26716 KB Output is correct
18 Correct 5 ms 26716 KB Output is correct
19 Correct 5 ms 26716 KB Output is correct
20 Correct 6 ms 26716 KB Output is correct
21 Correct 5 ms 26716 KB Output is correct
22 Correct 5 ms 26716 KB Output is correct
23 Correct 5 ms 26716 KB Output is correct
24 Correct 6 ms 26716 KB Output is correct
25 Correct 5 ms 26716 KB Output is correct
26 Correct 6 ms 26712 KB Output is correct
27 Correct 5 ms 26716 KB Output is correct
28 Correct 5 ms 26716 KB Output is correct
29 Correct 5 ms 26716 KB Output is correct
30 Correct 5 ms 26844 KB Output is correct
31 Correct 6 ms 26860 KB Output is correct
32 Correct 6 ms 26716 KB Output is correct
33 Correct 5 ms 26724 KB Output is correct
34 Correct 6 ms 26716 KB Output is correct
35 Correct 6 ms 26720 KB Output is correct
36 Correct 5 ms 26716 KB Output is correct
37 Correct 5 ms 26716 KB Output is correct
38 Correct 147 ms 85696 KB Output is correct
39 Correct 139 ms 85708 KB Output is correct
40 Correct 6 ms 26712 KB Output is correct
41 Correct 5 ms 26720 KB Output is correct
42 Correct 6 ms 26864 KB Output is correct
43 Correct 6 ms 26716 KB Output is correct
44 Correct 7 ms 27492 KB Output is correct
45 Correct 7 ms 27484 KB Output is correct
46 Correct 7 ms 27372 KB Output is correct
47 Correct 7 ms 27228 KB Output is correct
48 Correct 145 ms 94812 KB Output is correct
49 Correct 133 ms 91788 KB Output is correct
50 Correct 135 ms 87200 KB Output is correct
51 Correct 143 ms 85708 KB Output is correct
52 Correct 5 ms 26716 KB Output is correct
53 Correct 5 ms 26716 KB Output is correct
54 Correct 5 ms 26716 KB Output is correct
55 Correct 5 ms 26716 KB Output is correct
56 Correct 5 ms 26716 KB Output is correct
57 Correct 6 ms 26968 KB Output is correct
58 Correct 6 ms 26716 KB Output is correct
59 Correct 6 ms 26716 KB Output is correct
60 Correct 6 ms 26716 KB Output is correct
61 Correct 7 ms 26716 KB Output is correct
62 Correct 6 ms 26968 KB Output is correct
63 Correct 6 ms 26972 KB Output is correct
64 Correct 7 ms 26972 KB Output is correct
65 Correct 6 ms 26852 KB Output is correct
66 Correct 96 ms 40044 KB Output is correct
67 Correct 91 ms 39112 KB Output is correct
68 Correct 93 ms 39436 KB Output is correct
69 Correct 98 ms 39712 KB Output is correct
70 Correct 5 ms 26716 KB Output is correct
71 Correct 6 ms 26716 KB Output is correct
72 Correct 7 ms 26972 KB Output is correct
73 Correct 8 ms 26900 KB Output is correct
74 Correct 138 ms 56364 KB Output is correct
75 Correct 179 ms 52356 KB Output is correct
76 Correct 5 ms 26716 KB Output is correct
77 Correct 6 ms 26716 KB Output is correct
78 Correct 6 ms 26716 KB Output is correct
79 Correct 6 ms 26716 KB Output is correct
80 Correct 5 ms 26716 KB Output is correct
81 Correct 6 ms 26716 KB Output is correct
82 Correct 6 ms 26716 KB Output is correct
83 Correct 6 ms 26716 KB Output is correct
84 Correct 5 ms 26888 KB Output is correct
85 Correct 7 ms 26716 KB Output is correct
86 Correct 7 ms 26972 KB Output is correct
87 Correct 8 ms 27484 KB Output is correct
88 Correct 7 ms 27484 KB Output is correct
89 Correct 7 ms 27484 KB Output is correct
90 Correct 6 ms 27228 KB Output is correct
91 Correct 7 ms 27484 KB Output is correct
92 Correct 7 ms 27148 KB Output is correct
93 Correct 7 ms 27144 KB Output is correct
94 Correct 7 ms 26972 KB Output is correct
95 Correct 7 ms 26972 KB Output is correct
96 Correct 6 ms 26960 KB Output is correct
97 Correct 7 ms 26968 KB Output is correct
98 Correct 8 ms 27224 KB Output is correct
99 Correct 7 ms 27228 KB Output is correct
100 Correct 6 ms 27104 KB Output is correct
101 Correct 7 ms 27228 KB Output is correct
102 Correct 7 ms 27224 KB Output is correct
103 Correct 8 ms 26968 KB Output is correct
104 Correct 7 ms 26972 KB Output is correct
105 Correct 6 ms 27096 KB Output is correct
106 Correct 7 ms 26972 KB Output is correct
107 Correct 8 ms 27152 KB Output is correct
108 Correct 7 ms 27120 KB Output is correct
109 Correct 6 ms 27228 KB Output is correct
110 Correct 7 ms 26968 KB Output is correct
111 Correct 142 ms 96532 KB Output is correct
112 Correct 130 ms 92932 KB Output is correct
113 Correct 126 ms 91520 KB Output is correct
114 Correct 118 ms 87180 KB Output is correct
115 Correct 153 ms 82756 KB Output is correct
116 Correct 126 ms 62464 KB Output is correct
117 Correct 193 ms 58036 KB Output is correct
118 Correct 144 ms 58112 KB Output is correct
119 Correct 143 ms 58620 KB Output is correct
120 Correct 132 ms 58004 KB Output is correct
121 Correct 120 ms 56260 KB Output is correct
122 Correct 166 ms 55960 KB Output is correct
123 Correct 149 ms 56632 KB Output is correct
124 Correct 140 ms 57312 KB Output is correct
125 Correct 133 ms 57396 KB Output is correct
126 Correct 113 ms 54444 KB Output is correct
127 Correct 120 ms 67968 KB Output is correct
128 Correct 114 ms 68552 KB Output is correct
129 Correct 101 ms 55804 KB Output is correct
130 Correct 98 ms 54736 KB Output is correct
131 Correct 97 ms 54768 KB Output is correct
132 Correct 96 ms 54692 KB Output is correct
133 Correct 98 ms 54512 KB Output is correct
134 Correct 99 ms 54520 KB Output is correct
135 Correct 116 ms 64988 KB Output is correct
136 Correct 114 ms 60528 KB Output is correct
137 Correct 163 ms 76376 KB Output is correct
138 Correct 124 ms 63868 KB Output is correct
139 Correct 195 ms 58312 KB Output is correct
140 Correct 153 ms 58564 KB Output is correct
141 Correct 149 ms 58304 KB Output is correct
142 Correct 136 ms 58120 KB Output is correct
143 Correct 129 ms 57028 KB Output is correct
144 Correct 154 ms 55288 KB Output is correct
145 Correct 147 ms 55216 KB Output is correct
146 Correct 137 ms 56488 KB Output is correct
147 Correct 140 ms 58204 KB Output is correct
148 Correct 130 ms 54844 KB Output is correct
149 Correct 118 ms 68028 KB Output is correct
150 Correct 112 ms 68160 KB Output is correct
151 Correct 103 ms 56772 KB Output is correct
152 Correct 100 ms 55728 KB Output is correct
153 Correct 101 ms 55492 KB Output is correct
154 Correct 101 ms 55416 KB Output is correct
155 Correct 102 ms 55404 KB Output is correct
156 Correct 99 ms 55496 KB Output is correct
157 Correct 124 ms 66052 KB Output is correct
158 Correct 118 ms 61192 KB Output is correct