QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297108#6103. A+B ProblemPhantomThreshold#AC ✓104ms34164kbC++201.9kb2024-01-03 23:07:292024-01-03 23:07:30

Judging History

你现在查看的是最新测评结果

  • [2024-01-03 23:07:30]
  • 评测
  • 测评结果:AC
  • 用时:104ms
  • 内存:34164kb
  • [2024-01-03 23:07:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<int>> T(n+5);
	for(int i=2;i<=n;i++)
	{
		int p;
		cin>>p;
		T[p].push_back(i);
	}
	vector<int> leafs;
	vector<int> nx(n+5);
	function<void(int)> dfs=[&](int u)
	{
		if(T[u].empty())leafs.push_back(u);
		for(auto v:T[u])
		{
			dfs(v);
		}
	};
	dfs(1);
//	cerr<<"?"<<endl;
	int lcnt=(int)leafs.size();
	for(int i=0;i<lcnt;i++)
	{
		nx[leafs[i]]=leafs[(i+1)%lcnt];
	}
	vector<int> fi(n+5),la(n+5);
	vector<vector<int>> sets(n*4+5);
	vector<pair<int,int>> edges;
	int ind=0;
	function<int(int)> solve=[&](int u)
	{
		if(T[u].empty())
		{
			int now=++ind;
			sets[now].emplace_back(u);
			sets[now].emplace_back(nx[u]);
			fi[u]=u;
			la[u]=nx[u];
//			cerr<<"end "<<u<<' '<<ind<<endl;
			return now;
		}
		else
		{
			int pre=0;
			for(auto v:T[u])
			{
				int tmp=solve(v);
				int now=++ind;
				sets[now].emplace_back(u);
				sets[now].emplace_back(v);
				sets[now].emplace_back(fi[v]);
				sets[now].emplace_back(la[v]);
				edges.emplace_back(now,tmp);
				if(pre)
				{
					int ex=++ind;
					sets[ex].emplace_back(u);
					sets[ex].emplace_back(fi[u]);
					sets[ex].emplace_back(la[u]);
					sets[ex].emplace_back(la[v]);
					edges.emplace_back(ex,now);
					edges.emplace_back(ex,pre);
					la[u]=la[v];
					pre=ex;
				}
				else
				{
					pre=now;
					fi[u]=fi[v];
					la[u]=la[v];
				}
			}
//			cerr<<"end "<<u<<' '<<ind<<endl;
			return pre;
		}
	};
	solve(1);
	cout<<ind<<endl;
	for(int i=1;i<=ind;i++)
	{
		sort(sets[i].begin(),sets[i].end());
		sets[i].resize(unique(sets[i].begin(),sets[i].end())-sets[i].begin());
		cout<<sets[i].size();
		for(auto x:sets[i])
			cout<<' '<<x;
		cout<<"\n";
	}
	for(auto [u,v]:edges)
	{
		cout<<u<<' '<<v<<"\n";
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3448kb

input:

4
1
1
1

output:

8
2 2 3
3 1 2 3
2 3 4
3 1 3 4
4 1 2 3 4
2 2 4
3 1 2 4
3 1 2 4
2 1
4 3
5 4
5 2
7 6
8 7
8 5

result:

ok partial = 0

Test #2:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

11
1
1
3
4
4
3
1
8
8
10

output:

21
2 2 5
3 1 2 5
2 5 6
3 4 5 6
2 6 7
3 4 6 7
4 4 5 6 7
4 3 4 5 7
2 7 9
3 3 7 9
4 3 5 7 9
4 1 3 5 9
4 1 2 5 9
2 9 11
3 8 9 11
2 2 11
3 2 10 11
4 2 8 10 11
4 2 8 9 11
4 1 2 8 9
3 1 2 9
2 1
4 3
6 5
7 6
7 4
8 7
10 9
11 10
11 8
12 11
13 12
13 2
15 14
17 16
18 17
19 18
19 15
20 19
21 20
21 13

result:

ok partial = 0

Test #3:

score: 0
Accepted
time: 49ms
memory: 23260kb

input:

99998
1
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
1
94
95
96
97
98
99
100
101...

output:

100896
2 2 93
3 1 2 93
2 93 842
3 92 93 842
4 91 92 93 842
4 90 91 93 842
4 89 90 93 842
4 88 89 93 842
4 87 88 93 842
4 86 87 93 842
4 85 86 93 842
4 84 85 93 842
4 83 84 93 842
4 82 83 93 842
4 81 82 93 842
4 80 81 93 842
4 79 80 93 842
4 78 79 93 842
4 77 78 93 842
4 76 77 93 842
4 75 76 93 842
4...

result:

ok partial = 0

Test #4:

score: 0
Accepted
time: 33ms
memory: 34164kb

input:

99998
1
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

100006
2 2 12098
3 1 2 12098
2 12098 16424
3 12097 12098 16424
4 12096 12097 12098 16424
4 12095 12096 12098 16424
4 12094 12095 12098 16424
4 12093 12094 12098 16424
4 12092 12093 12098 16424
4 12091 12092 12098 16424
4 12090 12091 12098 16424
4 12089 12090 12098 16424
4 12088 12089 12098 16424
4 1...

result:

ok partial = 0

Test #5:

score: 0
Accepted
time: 91ms
memory: 28848kb

input:

99998
1
2
3
3
5
6
6
8
9
10
11
11
11
14
15
15
17
17
19
20
21
21
23
23
25
25
27
27
29
30
31
32
33
34
35
35
37
38
39
40
40
42
42
44
45
46
47
48
48
50
50
52
53
54
55
55
57
58
58
60
61
62
63
64
65
65
67
68
69
70
70
72
73
74
75
76
76
78
79
80
80
82
82
84
85
85
87
87
89
90
91
91
93
93
93
96
96
98
98
100
10...

output:

218306
2 4 7
3 3 4 7
2 7 12
3 6 7 12
2 12 13
3 11 12 13
2 13 16
3 11 13 16
4 11 12 13 16
2 16 18
3 15 16 18
2 18 22
3 17 18 22
2 22 24
3 21 22 24
2 24 26
3 23 24 26
2 26 28
3 25 26 28
2 28 36
3 27 28 36
2 36 41
3 35 36 41
2 41 43
3 40 41 43
2 43 49
3 42 43 49
2 49 51
3 48 49 51
2 51 56
3 50 51 56
2 ...

result:

ok partial = 0

Test #6:

score: 0
Accepted
time: 75ms
memory: 31592kb

input:

99997
1
1
3
4
4
6
6
8
9
9
11
11
13
13
15
15
17
18
19
20
21
22
23
23
25
25
27
28
29
30
31
31
33
33
35
35
37
37
39
40
40
42
42
44
44
46
46
48
48
50
51
51
53
53
55
56
57
57
59
59
61
62
62
64
64
66
66
68
69
69
71
72
73
73
75
76
76
78
78
80
80
82
82
84
84
86
86
88
88
90
91
91
93
93
95
95
97
97
99
99
101
...

output:

200011
2 2 5
3 1 2 5
2 5 7
3 4 5 7
2 7 10
3 6 7 10
2 10 12
3 9 10 12
2 12 14
3 11 12 14
2 14 16
3 13 14 16
2 16 24
3 15 16 24
2 24 26
3 23 24 26
2 26 32
3 25 26 32
2 32 34
3 31 32 34
2 34 36
3 33 34 36
2 36 38
3 35 36 38
2 38 41
3 37 38 41
2 41 43
3 40 41 43
2 43 45
3 42 43 45
2 45 47
3 44 45 47
2 4...

result:

ok partial = 0

Test #7:

score: 0
Accepted
time: 84ms
memory: 29216kb

input:

99998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

299990
2 2 3
3 1 2 3
2 3 4
3 1 3 4
4 1 2 3 4
2 4 5
3 1 4 5
4 1 2 4 5
2 5 6
3 1 5 6
4 1 2 5 6
2 6 7
3 1 6 7
4 1 2 6 7
2 7 8
3 1 7 8
4 1 2 7 8
2 8 9
3 1 8 9
4 1 2 8 9
2 9 10
3 1 9 10
4 1 2 9 10
2 10 11
3 1 10 11
4 1 2 10 11
2 11 12
3 1 11 12
4 1 2 11 12
2 12 13
3 1 12 13
4 1 2 12 13
2 13 14
3 1 13 14
...

result:

ok partial = 0

Test #8:

score: 0
Accepted
time: 83ms
memory: 25212kb

input:

99998
1
1
3
1
5
6
6
8
9
10
10
12
13
13
15
15
17
18
13
20
21
22
23
23
25
26
27
28
29
30
30
28
25
34
35
36
37
38
39
40
41
42
43
40
45
39
47
48
49
39
51
51
53
54
55
54
54
51
59
38
61
62
37
64
64
66
66
68
69
70
70
72
73
74
74
74
68
66
79
80
81
82
83
81
80
86
87
64
89
90
91
92
92
90
95
89
97
98
98
100
10...

output:

181116
2 2 4
3 1 2 4
2 4 7
3 3 4 7
4 1 3 4 7
4 1 2 4 7
2 7 11
3 6 7 11
2 11 14
3 10 11 14
2 14 16
3 13 14 16
2 16 19
3 15 16 19
2 19 24
3 18 19 24
4 17 18 19 24
4 15 17 19 24
4 15 16 19 24
4 13 15 16 24
4 13 14 16 24
2 24 31
3 23 24 31
2 31 32
3 30 31 32
2 32 33
3 30 32 33
4 30 31 32 33
4 29 30 31 3...

result:

ok partial = 0

Test #9:

score: 0
Accepted
time: 77ms
memory: 25756kb

input:

99998
1
1
3
4
3
6
6
6
3
10
11
12
13
12
12
10
10
18
19
20
21
22
22
22
20
26
27
28
27
30
30
32
33
30
35
36
36
36
39
36
41
41
43
35
35
46
47
48
49
47
51
47
53
46
55
35
57
35
59
59
61
30
63
27
65
65
65
68
68
65
65
72
72
27
75
26
77
78
79
80
78
82
83
78
77
86
77
88
89
88
77
92
92
94
94
96
26
26
99
99
26
...

output:

199486
2 2 5
3 1 2 5
2 5 7
3 4 5 7
4 3 4 5 7
2 7 8
3 6 7 8
2 8 9
3 6 8 9
4 6 7 8 9
2 9 14
3 6 9 14
4 6 7 9 14
4 3 6 7 14
4 3 5 7 14
2 14 15
3 13 14 15
4 12 13 14 15
2 15 16
3 12 15 16
4 12 14 15 16
2 16 17
3 12 16 17
4 12 14 16 17
4 11 12 14 17
4 10 11 14 17
2 17 23
3 10 17 23
4 10 14 17 23
2 23 24
...

result:

ok partial = 0

Test #10:

score: 0
Accepted
time: 76ms
memory: 25680kb

input:

99999
1
1
3
3
5
6
6
5
9
10
11
12
13
13
12
16
16
11
19
20
20
19
23
23
10
26
27
27
29
30
31
32
33
33
32
36
36
31
39
40
40
39
43
43
30
46
47
48
48
47
51
51
46
54
55
55
54
58
58
29
61
62
63
64
64
63
67
67
62
70
71
71
70
74
74
61
77
78
79
79
81
78
83
83
77
86
87
87
86
90
90
27
93
94
95
96
97
98
99
100
10...

output:

199981
2 2 4
3 1 2 4
2 4 7
3 3 4 7
2 7 8
3 6 7 8
2 8 14
3 6 8 14
4 6 7 8 14
4 5 6 7 14
2 14 15
3 13 14 15
2 15 17
3 13 15 17
4 13 14 15 17
4 12 13 14 17
2 17 18
3 16 17 18
2 18 21
3 16 18 21
4 16 17 18 21
4 12 16 17 21
4 12 14 17 21
4 11 12 14 21
2 21 22
3 20 21 22
2 22 24
3 20 22 24
4 20 21 22 24
4...

result:

ok partial = 0

Test #11:

score: 0
Accepted
time: 104ms
memory: 29588kb

input:

99999
1
1
3
3
3
6
7
7
7
7
7
7
7
7
15
7
7
6
19
19
19
19
19
19
19
19
19
19
6
30
30
30
30
30
30
30
30
30
30
6
41
41
41
41
41
41
41
41
41
41
6
52
52
52
52
52
52
52
52
52
52
6
63
63
63
63
63
63
63
63
63
63
6
74
74
74
74
74
74
74
74
74
74
6
85
85
85
85
85
85
85
85
85
85
6
96
96
96
96
96
96
96
96
96
96
6
1...

output:

278401
2 2 4
3 1 2 4
2 4 5
3 3 4 5
2 5 8
3 3 5 8
4 3 4 5 8
2 8 9
3 7 8 9
2 9 10
3 7 9 10
4 7 8 9 10
2 10 11
3 7 10 11
4 7 8 10 11
2 11 12
3 7 11 12
4 7 8 11 12
2 12 13
3 7 12 13
4 7 8 12 13
2 13 14
3 7 13 14
4 7 8 13 14
2 14 16
3 7 14 16
4 7 8 14 16
2 16 17
3 15 16 17
4 7 15 16 17
4 7 8 16 17
2 17 1...

result:

ok partial = 0

Test #12:

score: 0
Accepted
time: 96ms
memory: 29336kb

input:

99999
1
1
3
3
3
3
3
3
3
3
3
3
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
31
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
...

output:

296039
2 2 4
3 1 2 4
2 4 5
3 3 4 5
2 5 6
3 3 5 6
4 3 4 5 6
2 6 7
3 3 6 7
4 3 4 6 7
2 7 8
3 3 7 8
4 3 4 7 8
2 8 9
3 3 8 9
4 3 4 8 9
2 9 10
3 3 9 10
4 3 4 9 10
2 10 11
3 3 10 11
4 3 4 10 11
2 11 12
3 3 11 12
4 3 4 11 12
2 12 15
3 3 12 15
4 3 4 12 15
2 15 16
3 14 15 16
2 16 17
3 14 16 17
4 14 15 16 17
...

result:

ok partial = 0

Test #13:

score: 0
Accepted
time: 95ms
memory: 29208kb

input:

99999
1
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
36
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
134
3
3
3
3
3
3
3
3
3
3
3
3...

output:

297811
2 2 4
3 1 2 4
2 4 5
3 3 4 5
2 5 6
3 3 5 6
4 3 4 5 6
2 6 7
3 3 6 7
4 3 4 6 7
2 7 8
3 3 7 8
4 3 4 7 8
2 8 9
3 3 8 9
4 3 4 8 9
2 9 10
3 3 9 10
4 3 4 9 10
2 10 11
3 3 10 11
4 3 4 10 11
2 11 12
3 3 11 12
4 3 4 11 12
2 12 13
3 3 12 13
4 3 4 12 13
2 13 14
3 3 13 14
4 3 4 13 14
2 14 15
3 3 14 15
4 3 ...

result:

ok partial = 0

Test #14:

score: 0
Accepted
time: 81ms
memory: 25364kb

input:

99998
1
2
3
4
5
6
7
7
9
10
11
12
11
14
14
16
17
18
16
20
16
10
10
10
6
26
27
28
29
30
30
32
30
34
28
27
26
38
5
40
41
42
43
44
45
46
47
47
49
50
49
47
53
54
54
56
57
58
53
60
61
62
63
53
65
66
46
68
69
70
71
72
73
74
74
68
77
46
79
80
81
82
83
82
85
81
87
88
89
88
79
92
93
94
95
95
97
98
95
93
101
1...

output:

186632
2 8 13
3 7 8 13
2 13 15
3 12 13 15
4 11 12 13 15
2 15 19
3 14 15 19
2 19 21
3 18 19 21
4 17 18 19 21
4 16 17 19 21
2 21 22
3 20 21 22
4 16 20 21 22
4 16 19 21 22
2 22 23
3 16 22 23
4 16 19 22 23
4 14 16 19 23
4 14 15 19 23
4 11 14 15 23
4 11 13 15 23
4 10 11 13 23
2 23 24
3 10 23 24
4 10 13 2...

result:

ok partial = 0

Test #15:

score: 0
Accepted
time: 61ms
memory: 25148kb

input:

99999
1
1
3
4
5
6
7
8
9
10
11
11
11
14
14
16
17
17
19
20
21
22
23
24
25
26
27
25
29
30
31
31
25
24
35
35
21
20
39
40
39
42
43
44
42
46
16
11
10
50
51
52
53
53
55
56
57
58
58
60
60
62
62
62
65
65
58
55
69
70
71
70
73
74
70
76
77
70
79
80
79
79
83
84
85
86
87
88
86
90
91
91
93
94
95
86
97
98
99
100
10...

output:

182151
2 2 12
3 1 2 12
2 12 13
3 11 12 13
2 13 15
3 11 13 15
4 11 12 13 15
2 15 18
3 14 15 18
2 18 28
3 17 18 28
2 28 32
3 27 28 32
4 26 27 28 32
4 25 26 28 32
2 32 33
3 31 32 33
2 33 34
3 31 33 34
4 31 32 33 34
4 30 31 32 34
4 29 30 32 34
4 25 29 32 34
4 25 28 32 34
2 34 36
3 25 34 36
4 25 28 34 36...

result:

ok partial = 0

Test #16:

score: 0
Accepted
time: 73ms
memory: 25092kb

input:

100000
1
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
51
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
68
73
74
75
76
77
78
79
80
81
80
83
83
80
86
87
88
89
90
91
92
93
93
95
96
96
98
99
99
10...

output:

173542
2 2 52
3 1 2 52
2 52 72
3 51 52 72
2 72 82
3 71 72 82
4 70 71 72 82
4 69 70 72 82
4 68 69 72 82
2 82 84
3 81 82 84
4 80 81 82 84
2 84 85
3 83 84 85
2 85 94
3 83 85 94
4 83 84 85 94
4 80 83 84 94
4 80 82 84 94
2 94 97
3 93 94 97
2 97 100
3 96 97 100
2 100 106
3 99 100 106
2 106 114
3 105 106 1...

result:

ok partial = 0

Test #17:

score: 0
Accepted
time: 79ms
memory: 31352kb

input:

99998
1
2
3
4
4
6
6
6
9
9
11
12
12
14
14
16
17
17
19
19
19
22
23
23
23
26
27
27
29
29
31
32
33
33
35
36
37
38
38
40
41
42
43
44
44
46
46
48
48
50
51
52
53
54
55
56
57
58
59
59
61
62
63
64
65
66
67
68
69
69
69
72
72
72
75
75
75
78
79
80
80
80
83
84
84
86
87
88
89
90
90
92
93
93
95
95
95
98
99
99
99
1...

output:

200744
2 5 7
3 4 5 7
2 7 8
3 6 7 8
2 8 10
3 6 8 10
4 6 7 8 10
2 10 13
3 9 10 13
2 13 15
3 12 13 15
2 15 18
3 14 15 18
2 18 20
3 17 18 20
2 20 21
3 19 20 21
2 21 24
3 19 21 24
4 19 20 21 24
2 24 25
3 23 24 25
2 25 28
3 23 25 28
4 23 24 25 28
2 28 30
3 27 28 30
2 30 34
3 29 30 34
2 34 39
3 33 34 39
2 ...

result:

ok partial = 0

Test #18:

score: 0
Accepted
time: 18ms
memory: 13220kb

input:

50313
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

50945
2 315 584
3 314 315 584
4 313 314 315 584
4 312 313 315 584
4 311 312 315 584
4 310 311 315 584
4 309 310 315 584
4 308 309 315 584
4 307 308 315 584
4 306 307 315 584
4 305 306 315 584
4 304 305 315 584
4 303 304 315 584
4 302 303 315 584
4 301 302 315 584
4 300 301 315 584
4 299 300 315 584
...

result:

ok partial = 0

Test #19:

score: 0
Accepted
time: 67ms
memory: 31868kb

input:

99990
1
1
3
3
5
5
7
7
9
9
11
11
13
13
15
15
17
17
19
19
21
21
23
23
25
25
27
27
29
29
31
31
33
33
35
35
37
37
39
39
41
41
43
43
45
45
47
47
49
49
51
51
53
53
55
55
57
57
59
59
61
61
63
63
65
65
67
67
69
69
71
71
73
73
75
75
77
77
79
79
81
81
83
83
85
85
87
87
89
89
91
91
93
93
95
95
97
97
99
99
101
...

output:

199978
2 2 4
3 1 2 4
2 4 6
3 3 4 6
2 6 8
3 5 6 8
2 8 10
3 7 8 10
2 10 12
3 9 10 12
2 12 14
3 11 12 14
2 14 16
3 13 14 16
2 16 18
3 15 16 18
2 18 20
3 17 18 20
2 20 22
3 19 20 22
2 22 24
3 21 22 24
2 24 26
3 23 24 26
2 26 28
3 25 26 28
2 28 30
3 27 28 30
2 30 32
3 29 30 32
2 32 34
3 31 32 34
2 34 36
...

result:

ok partial = 0

Test #20:

score: 0
Accepted
time: 46ms
memory: 18188kb

input:

70338
1
1
3
4
5
6
6
8
9
9
11
8
13
14
15
16
17
16
19
15
21
22
23
24
22
26
27
28
28
30
31
27
33
34
35
36
37
37
39
36
41
42
43
44
45
44
47
48
48
50
47
52
53
54
55
52
57
58
59
58
61
62
43
64
14
66
67
68
69
68
71
67
73
74
75
76
77
78
79
80
81
81
83
84
80
86
87
88
88
90
91
92
93
93
95
96
96
98
91
100
87
1...

output:

111020
2 2 7
3 1 2 7
2 7 10
3 6 7 10
2 10 12
3 9 10 12
2 12 18
3 11 12 18
4 9 11 12 18
4 9 10 12 18
4 8 9 10 18
2 18 20
3 17 18 20
4 16 17 18 20
2 20 25
3 19 20 25
4 16 19 20 25
4 16 18 20 25
4 15 16 18 25
2 25 29
3 24 25 29
4 23 24 25 29
4 22 23 25 29
2 29 32
3 28 29 32
2 32 38
3 31 32 38
4 30 31 3...

result:

ok partial = 0

Test #21:

score: 0
Accepted
time: 52ms
memory: 19288kb

input:

75063
1
2
3
4
5
6
7
8
8
10
6
12
5
14
14
16
17
18
18
20
21
22
21
24
24
26
20
28
29
29
31
32
33
31
35
28
37
17
39
40
39
42
43
43
45
46
47
48
46
50
51
52
53
45
55
55
57
42
59
60
59
62
63
64
63
66
67
67
69
69
71
72
73
73
75
76
71
78
62
80
81
82
82
84
85
86
86
88
81
90
91
92
92
94
91
96
97
97
99
100
96
1...

output:

125193
2 9 11
3 8 9 11
2 11 13
3 10 11 13
4 8 10 11 13
4 8 9 11 13
4 7 8 9 13
4 6 7 9 13
2 13 15
3 12 13 15
4 6 12 13 15
4 6 9 13 15
4 5 6 9 15
2 15 19
3 14 15 19
2 19 23
3 18 19 23
2 23 25
3 22 23 25
4 21 22 23 25
2 25 27
3 24 25 27
2 27 30
3 26 27 30
4 24 26 27 30
4 24 25 27 30
4 21 24 25 30
4 21 ...

result:

ok partial = 0

Test #22:

score: 0
Accepted
time: 43ms
memory: 18676kb

input:

71756
1
2
1
4
5
5
7
8
9
10
11
12
13
14
15
16
17
18
19
17
21
13
23
24
25
26
27
27
29
24
31
32
32
34
12
36
11
38
39
40
40
42
43
43
45
46
38
48
49
50
51
51
53
54
55
56
55
58
59
60
61
62
59
64
65
58
67
68
53
70
71
72
73
74
73
76
76
78
71
80
81
82
83
82
85
80
87
88
89
90
91
89
93
93
95
96
97
98
98
100
10...

output:

115274
2 3 6
3 2 3 6
4 1 2 3 6
2 6 20
3 5 6 20
2 20 22
3 19 20 22
4 18 19 20 22
4 17 18 20 22
2 22 28
3 21 22 28
4 17 21 22 28
4 17 20 22 28
4 16 17 20 28
4 15 16 20 28
4 14 15 20 28
4 13 14 20 28
2 28 30
3 27 28 30
2 30 33
3 29 30 33
4 27 29 30 33
4 27 28 30 33
4 26 27 28 33
4 25 26 28 33
4 24 25 2...

result:

ok partial = 0

Test #23:

score: 0
Accepted
time: 50ms
memory: 18168kb

input:

70450
1
2
3
4
5
6
7
8
8
10
11
12
13
14
13
16
17
18
18
20
20
22
23
24
25
17
27
28
28
30
31
32
33
32
35
36
37
38
39
40
41
42
42
44
44
46
39
48
37
50
50
52
53
54
54
56
57
58
59
58
61
62
63
63
65
61
67
68
69
69
71
72
73
74
72
76
77
78
79
80
81
81
83
84
80
86
77
88
89
90
68
92
92
94
95
95
97
98
99
99
101...

output:

111354
2 9 15
3 8 9 15
2 15 19
3 14 15 19
4 13 14 15 19
2 19 21
3 18 19 21
2 21 26
3 20 21 26
2 26 29
3 25 26 29
4 24 25 26 29
4 23 24 26 29
4 22 23 26 29
4 20 22 26 29
4 20 21 26 29
4 18 20 21 29
4 18 19 21 29
4 17 18 19 29
2 29 34
3 28 29 34
2 34 43
3 33 34 43
4 32 33 34 43
2 43 45
3 42 43 45
2 45...

result:

ok partial = 0

Test #24:

score: 0
Accepted
time: 48ms
memory: 17752kb

input:

68358
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
38
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
58
60
61
62
63
64
64
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
91
93
94
95
96
97
98
99
100
10...

output:

105078
2 39 59
3 38 39 59
2 59 65
3 58 59 65
2 65 92
3 64 65 92
2 92 105
3 91 92 105
2 105 108
3 104 105 108
2 108 112
3 107 108 112
2 112 123
3 111 112 123
2 123 125
3 122 123 125
4 121 122 123 125
2 125 127
3 124 125 127
2 127 140
3 126 127 140
4 124 126 127 140
4 124 125 127 140
4 121 124 125 140...

result:

ok partial = 0

Test #25:

score: 0
Accepted
time: 46ms
memory: 29184kb

input:

98004
1
2
2
4
4
6
6
8
8
10
10
12
12
14
14
16
16
18
18
20
20
22
22
24
24
26
26
28
28
30
30
32
32
34
34
36
36
38
38
40
40
42
42
44
44
46
46
48
48
50
50
52
52
54
54
56
56
58
58
60
60
62
62
64
64
66
66
68
68
70
70
72
72
74
74
76
76
78
78
80
80
82
82
84
84
86
86
88
88
90
90
92
92
94
94
96
96
98
98
100
10...

output:

146008
2 3 5
3 2 3 5
2 5 7
3 4 5 7
2 7 9
3 6 7 9
2 9 11
3 8 9 11
2 11 13
3 10 11 13
2 13 15
3 12 13 15
2 15 17
3 14 15 17
2 17 19
3 16 17 19
2 19 21
3 18 19 21
2 21 23
3 20 21 23
2 23 25
3 22 23 25
2 25 27
3 24 25 27
2 27 29
3 26 27 29
2 29 31
3 28 29 31
2 31 33
3 30 31 33
2 33 35
3 32 33 35
2 35 37...

result:

ok partial = 0

Test #26:

score: 0
Accepted
time: 67ms
memory: 31640kb

input:

98003
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

146007
2 15371 15373
3 15370 15371 15373
2 15373 15375
3 15372 15373 15375
2 15375 15377
3 15374 15375 15377
2 15377 15379
3 15376 15377 15379
2 15379 15381
3 15378 15379 15381
2 15381 15383
3 15380 15381 15383
2 15383 15385
3 15382 15383 15385
2 15385 15387
3 15384 15385 15387
2 15387 15389
3 15386...

result:

ok partial = 0

Test #27:

score: 0
Accepted
time: 60ms
memory: 31312kb

input:

98003
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

146007
2 9939 9941
3 9938 9939 9941
2 9941 9943
3 9940 9941 9943
2 9943 9945
3 9942 9943 9945
2 9945 9947
3 9944 9945 9947
2 9947 9949
3 9946 9947 9949
2 9949 9951
3 9948 9949 9951
2 9951 9953
3 9950 9951 9953
2 9953 9955
3 9952 9953 9955
2 9955 9957
3 9954 9955 9957
2 9957 9959
3 9956 9957 9959
2 9...

result:

ok partial = 0