QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108210#6103. A+B ProblemforeverloseAC ✓230ms56244kbC++142.0kb2023-05-23 21:34:142023-05-23 21:35:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-23 21:35:56]
  • 评测
  • 测评结果:AC
  • 用时:230ms
  • 内存:56244kb
  • [2023-05-23 21:34:14]
  • 提交

answer

#include<bits/stdc++.h>
#define ci const int
using namespace std;
#define ll long long
#define rep(i, x, y) for(int i = (x), stOxrj = (y); i <= stOxrj; ++i)
#define irep(i, x, y) for(int i = (x), stOxrj = (y); i >= stOxrj; --i)
#define pb emplace_back
#define all(S) S.begin(), S.end()
#define Size(S) (int)S.size()
#define fi first
#define se second
#define il inline
#define let const auto
using pii = pair<int, int>;
using vint = vector<int>;
template<typename T>
il void tmax(T &x, const T &y) { if(x < y) x = y; }
template<typename T>
il void tmin(T &x, const T &y) { if(x > y) x = y; }
il int read() {
    int res = 0, flag = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') flag = -1; c = getchar(); }
    while(c >= '0' && c <= '9') res = res * 10 + c - '0', c = getchar();
    return res * flag;
}
const int N = 5e5 + 20;
vint G[N];
vint ans[N];
int pr[N], ct;
int newn(vint sons, vint s) {
    ans[++ct] = s;
    for(int x : sons) pr[x] = ct;
    return ct;
}
tuple<int, int, int> dfs(int u, int faz) {
    if(!G[u].size()) return make_tuple(newn({}, {u, faz}), u, u);
    int al, lstr, id = 0;
    for(int v : G[u]) {
        auto [nid, l, r] = dfs(v, u);
        if(!id) {
            al = l, lstr = r;
            id = newn({nid}, {u, l, r});
            continue;
        } 
        id = newn({id}, {u, al, lstr, l});
        id = newn({id, nid}, {u, al, l, r});
        lstr = r;
    }
    if(!faz) return make_tuple(0, 0, 0);
    return make_tuple(newn({id}, {u, faz, al, lstr}), al, lstr);
}
signed main() { 
    // freopen("1.in", "r", stdin); 
    int n = read();
    rep(i, 2, n) G[read()].pb(i);
    dfs(1, 0);
    cout << ct << '\n';
    rep(i, 1, ct) {
        set<int> s;
        for(int x : ans[i]) s.insert(x);
        cout << s.size() << '\n';
        for(int x : s) cout << x << ' ';
        cout << '\n';
    }
    rep(i, 1, ct - 1) cout << i << ' ' << pr[i] << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1
1
1

output:

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

result:

ok partial = 0

Test #2:

score: 0
Accepted
time: 1ms
memory: 26896kb

input:

11
1
1
3
4
4
3
1
8
8
10

output:

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

result:

ok partial = 0

Test #3:

score: 0
Accepted
time: 126ms
memory: 37212kb

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:

200443
2
1 2 
2
1 2 
2
92 93 
2
92 93 
3
91 92 93 
2
91 93 
3
90 91 93 
2
90 93 
3
89 90 93 
2
89 93 
3
88 89 93 
2
88 93 
3
87 88 93 
2
87 93 
3
86 87 93 
2
86 93 
3
85 86 93 
2
85 93 
3
84 85 93 
2
84 93 
3
83 84 93 
2
83 93 
3
82 83 93 
2
82 93 
3
81 82 93 
2
81 93 
3
80 81 93 
2
80 93 
3
79 80 9...

result:

ok partial = 0

Test #4:

score: 0
Accepted
time: 123ms
memory: 56244kb

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:

199998
2
1 2 
2
1 2 
2
12097 12098 
2
12097 12098 
3
12096 12097 12098 
2
12096 12098 
3
12095 12096 12098 
2
12095 12098 
3
12094 12095 12098 
2
12094 12098 
3
12093 12094 12098 
2
12093 12098 
3
12092 12093 12098 
2
12092 12098 
3
12091 12092 12098 
2
12091 12098 
3
12090 12091 12098 
2
12090 1209...

result:

ok partial = 0

Test #5:

score: 0
Accepted
time: 166ms
memory: 42940kb

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:

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

result:

ok partial = 0

Test #6:

score: 0
Accepted
time: 191ms
memory: 48028kb

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:

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

result:

ok partial = 0

Test #7:

score: 0
Accepted
time: 210ms
memory: 38140kb

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
1 2 
2
1 2 
2
1 3 
3
1 2 3 
3
1 2 3 
2
1 4 
4
1 2 3 4 
3
1 2 4 
2
1 5 
4
1 2 4 5 
3
1 2 5 
2
1 6 
4
1 2 5 6 
3
1 2 6 
2
1 7 
4
1 2 6 7 
3
1 2 7 
2
1 8 
4
1 2 7 8 
3
1 2 8 
2
1 9 
4
1 2 8 9 
3
1 2 9 
2
1 10 
4
1 2 9 10 
3
1 2 10 
2
1 11 
4
1 2 10 11 
3
1 2 11 
2
1 12 
4
1 2 11 12 
3
1 2 12 
...

result:

ok partial = 0

Test #8:

score: 0
Accepted
time: 184ms
memory: 38008kb

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:

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

result:

ok partial = 0

Test #9:

score: 0
Accepted
time: 176ms
memory: 38228kb

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:

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

result:

ok partial = 0

Test #10:

score: 0
Accepted
time: 146ms
memory: 37292kb

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:

249987
2
1 2 
2
1 2 
2
3 4 
2
3 4 
2
6 7 
2
6 7 
2
6 8 
3
6 7 8 
3
6 7 8 
4
5 6 7 8 
3
5 7 8 
2
13 14 
2
13 14 
2
13 15 
3
13 14 15 
3
13 14 15 
4
12 13 14 15 
3
12 14 15 
2
16 17 
2
16 17 
2
16 18 
3
16 17 18 
3
16 17 18 
4
12 16 17 18 
4
12 14 15 17 
4
12 14 17 18 
4
11 12 14 18 
3
11 14 18 
2
20 ...

result:

ok partial = 0

Test #11:

score: 0
Accepted
time: 178ms
memory: 38660kb

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:

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

result:

ok partial = 0

Test #12:

score: 0
Accepted
time: 199ms
memory: 38744kb

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:

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

result:

ok partial = 0

Test #13:

score: 0
Accepted
time: 230ms
memory: 37948kb

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:

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

result:

ok partial = 0

Test #14:

score: 0
Accepted
time: 169ms
memory: 37932kb

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:

243311
2
7 8 
2
7 8 
2
12 13 
2
12 13 
3
11 12 13 
2
11 13 
2
14 15 
2
14 15 
2
18 19 
2
18 19 
3
17 18 19 
2
17 19 
3
16 17 19 
2
16 19 
2
20 21 
2
20 21 
3
16 20 21 
3
16 19 21 
3
16 19 21 
2
16 22 
4
16 19 21 22 
3
16 19 22 
4
14 16 19 22 
3
14 15 19 
4
14 15 19 22 
4
11 14 15 22 
3
11 13 15 
4
1...

result:

ok partial = 0

Test #15:

score: 0
Accepted
time: 141ms
memory: 38316kb

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:

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

result:

ok partial = 0

Test #16:

score: 0
Accepted
time: 183ms
memory: 37488kb

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:

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

result:

ok partial = 0

Test #17:

score: 0
Accepted
time: 177ms
memory: 47316kb

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:

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

result:

ok partial = 0

Test #18:

score: 0
Accepted
time: 65ms
memory: 33608kb

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:

100940
2
314 315 
2
314 315 
3
313 314 315 
2
313 315 
3
312 313 315 
2
312 315 
3
311 312 315 
2
311 315 
3
310 311 315 
2
310 315 
3
309 310 315 
2
309 315 
3
308 309 315 
2
308 315 
3
307 308 315 
2
307 315 
3
306 307 315 
2
306 315 
3
305 306 315 
2
305 315 
3
304 305 315 
2
304 315 
3
303 304 3...

result:

ok partial = 0

Test #19:

score: 0
Accepted
time: 173ms
memory: 49172kb

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:

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

result:

ok partial = 0

Test #20:

score: 0
Accepted
time: 118ms
memory: 35464kb

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:

161015
2
1 2 
2
1 2 
2
6 7 
2
6 7 
2
9 10 
2
9 10 
2
11 12 
2
11 12 
3
9 11 12 
3
9 10 12 
3
9 10 12 
4
8 9 10 12 
3
8 10 12 
2
17 18 
2
17 18 
3
16 17 18 
2
16 18 
2
19 20 
2
19 20 
3
16 19 20 
3
16 18 20 
3
16 18 20 
4
15 16 18 20 
3
15 18 20 
2
24 25 
2
24 25 
3
23 24 25 
2
23 25 
3
22 23 25 
2
2...

result:

ok partial = 0

Test #21:

score: 0
Accepted
time: 128ms
memory: 35416kb

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:

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

result:

ok partial = 0

Test #22:

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

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:

165269
2
2 3 
2
2 3 
3
1 2 3 
2
1 3 
2
5 6 
2
5 6 
2
19 20 
2
19 20 
3
18 19 20 
2
18 20 
3
17 18 20 
2
17 20 
2
21 22 
2
21 22 
3
17 21 22 
3
17 20 22 
3
17 20 22 
4
16 17 20 22 
3
16 20 22 
4
15 16 20 22 
3
15 20 22 
4
14 15 20 22 
3
14 20 22 
4
13 14 20 22 
3
13 20 22 
2
27 28 
2
27 28 
2
29 30 
...

result:

ok partial = 0

Test #23:

score: 0
Accepted
time: 94ms
memory: 34172kb

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:

161350
2
8 9 
2
8 9 
2
14 15 
2
14 15 
3
13 14 15 
2
13 15 
2
18 19 
2
18 19 
2
20 21 
2
20 21 
2
25 26 
2
25 26 
3
24 25 26 
2
24 26 
3
23 24 26 
2
23 26 
3
22 23 26 
2
22 26 
3
20 22 26 
3
20 21 26 
3
20 21 26 
4
18 20 21 26 
3
18 19 21 
4
18 19 21 26 
4
17 18 19 26 
3
17 19 26 
2
28 29 
2
28 29 
...

result:

ok partial = 0

Test #24:

score: 0
Accepted
time: 101ms
memory: 34088kb

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:

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

result:

ok partial = 0

Test #25:

score: 0
Accepted
time: 145ms
memory: 45848kb

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:

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

result:

ok partial = 0

Test #26:

score: 0
Accepted
time: 133ms
memory: 50144kb

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:

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

result:

ok partial = 0

Test #27:

score: 0
Accepted
time: 139ms
memory: 49520kb

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:

220006
2
9938 9939 
2
9938 9939 
2
9940 9941 
2
9940 9941 
2
9942 9943 
2
9942 9943 
2
9944 9945 
2
9944 9945 
2
9946 9947 
2
9946 9947 
2
9948 9949 
2
9948 9949 
2
9950 9951 
2
9950 9951 
2
9952 9953 
2
9952 9953 
2
9954 9955 
2
9954 9955 
2
9956 9957 
2
9956 9957 
2
9958 9959 
2
9958 9959 
2
9960 ...

result:

ok partial = 0