QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#819203#2619. Diameter Twoship2077AC ✓1ms3952kbC++23980b2024-12-18 14:09:372024-12-18 14:09:37

Judging History

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

  • [2024-12-18 14:09:37]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3952kb
  • [2024-12-18 14:09:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m;vector<pair<int,int>>ans;
int read(){
    int x=0;char ch=getchar();
    while (!isdigit(ch)) ch=getchar();
    while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
    return x;
}
void solve(){
    n=read();m=read();ans.clear();
    if (n==m||m&&m==n-2) return puts("-1"),void();
    auto add=[&](auto x,auto y){ans.emplace_back(x,y);};
    if (m){
        for (int i=1;i<n;i++) add(i,n);
        for (int i=m+1;i<n;i+=2) add(i,i+(i==n-1?-1:1));
    }
    else if (n<=5){
        for (int i=1;i<=n;i++)
            add(i,i%n+1);
        }
    else if (n==6){
        for (int i=1;i<n;i++)
            add(i,i+1);
        add(1,5);add(2,6);
    }
    else{
        for (int i=1;i<n;i++) add(i,n);
        for (int i=1;i<n;i+=2) add(i,i+(i==n-1?-1:1));
    }
    printf("%d\n",(int)ans.size());
    for (auto [x,y]:ans) printf("%d %d\n",x,y);
}
int main(){int T=read();while (T--) solve();return 0;}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3852kb

input:

3
3 0
5 2
6 6

output:

3
1 2
2 3
3 1
5
1 5
2 5
3 5
4 5
3 4
-1

result:

ok ok, 3 test cases (3 test cases)

Test #2:

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

input:

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

output:

3
1 2
2 3
3 1
-1
2
1 3
2 3
-1
4
1 2
2 3
3 4
4 1
4
1 4
2 4
3 4
2 3
-1
3
1 4
2 4
3 4
-1
5
1 2
2 3
3 4
4 5
5 1
6
1 5
2 5
3 5
4 5
2 3
4 3
5
1 5
2 5
3 5
4 5
3 4
-1
4
1 5
2 5
3 5
4 5
-1
7
1 2
2 3
3 4
4 5
5 6
1 5
2 6
7
1 6
2 6
3 6
4 6
5 6
2 3
4 5
7
1 6
2 6
3 6
4 6
5 6
3 4
5 4
6
1 6
2 6
3 6
4 6
5 6
4 5
-1
5...

result:

ok ok, 39 test cases (39 test cases)

Test #3:

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

input:

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

output:

-1
-1
-1
7
1 6
2 6
3 6
4 6
5 6
3 4
5 4
7
1 7
2 7
3 7
4 7
5 7
6 7
5 6
6
1 6
2 6
3 6
4 6
5 6
4 5
8
1 7
2 7
3 7
4 7
5 7
6 7
4 5
6 5
-1
6
1 7
2 7
3 7
4 7
5 7
6 7
9
1 7
2 7
3 7
4 7
5 7
6 7
1 2
3 4
5 6
2
1 3
2 3
9
1 8
2 8
3 8
4 8
5 8
6 8
7 8
4 5
6 7
-1
7
1 2
2 3
3 4
4 5
5 6
1 5
2 6
5
1 6
2 6
3 6
4 6
5 6
-...

result:

ok ok, 39 test cases (39 test cases)

Test #4:

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

input:

50
23 15
42 41
18 4
30 27
38 33
9 2
37 36
28 16
3 3
28 7
39 28
37 17
46 14
20 10
8 5
44 32
25 19
18 11
41 26
33 15
21 4
7 4
44 26
22 17
34 13
20 19
32 25
11 1
50 24
42 22
40 40
50 12
21 15
41 2
3 3
11 7
45 25
36 6
4 1
23 20
27 24
26 24
27 10
8 5
32 1
13 5
9 4
14 11
12 8
47 13

output:

26
1 23
2 23
3 23
4 23
5 23
6 23
7 23
8 23
9 23
10 23
11 23
12 23
13 23
14 23
15 23
16 23
17 23
18 23
19 23
20 23
21 23
22 23
16 17
18 19
20 21
22 21
41
1 42
2 42
3 42
4 42
5 42
6 42
7 42
8 42
9 42
10 42
11 42
12 42
13 42
14 42
15 42
16 42
17 42
18 42
19 42
20 42
21 42
22 42
23 42
24 42
25 42
26 42
...

result:

ok ok, 50 test cases (50 test cases)

Test #5:

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

input:

50
27 10
8 2
46 4
29 14
48 41
18 16
25 24
27 23
4 1
46 16
48 16
18 11
9 4
28 26
50 41
33 16
45 5
10 5
48 29
10 6
34 33
39 37
36 17
16 2
47 10
30 10
28 4
14 8
38 38
47 32
26 17
29 10
24 12
17 10
47 14
45 8
40 0
35 0
32 26
47 33
45 44
28 1
35 13
44 7
49 20
20 7
36 20
27 18
18 9
45 39

output:

34
1 27
2 27
3 27
4 27
5 27
6 27
7 27
8 27
9 27
10 27
11 27
12 27
13 27
14 27
15 27
16 27
17 27
18 27
19 27
20 27
21 27
22 27
23 27
24 27
25 27
26 27
11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
10
1 8
2 8
3 8
4 8
5 8
6 8
7 8
3 4
5 6
7 6
66
1 46
2 46
3 46
4 46
5 46
6 46
7 46
8 46
9 46
10 46
11 46...

result:

ok ok, 50 test cases (50 test cases)

Test #6:

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

input:

50
25 19
41 28
26 12
35 19
48 36
33 10
47 46
37 2
43 3
49 49
31 9
33 11
43 13
42 42
26 20
46 10
14 11
35 34
19 9
41 19
31 27
41 40
29 13
23 0
45 17
34 30
31 2
12 4
50 32
43 1
42 28
32 0
43 26
44 33
41 35
36 8
35 16
33 14
44 12
39 9
45 25
46 8
43 41
27 15
47 8
31 15
39 12
45 30
43 8
49 23

output:

27
1 25
2 25
3 25
4 25
5 25
6 25
7 25
8 25
9 25
10 25
11 25
12 25
13 25
14 25
15 25
16 25
17 25
18 25
19 25
20 25
21 25
22 25
23 25
24 25
20 21
22 23
24 23
46
1 41
2 41
3 41
4 41
5 41
6 41
7 41
8 41
9 41
10 41
11 41
12 41
13 41
14 41
15 41
16 41
17 41
18 41
19 41
20 41
21 41
22 41
23 41
24 41
25 41
...

result:

ok ok, 50 test cases (50 test cases)

Test #7:

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

input:

50
48 26
22 20
26 26
34 23
24 22
29 29
46 28
50 10
34 15
17 0
47 38
37 30
31 21
46 44
37 17
42 33
46 41
40 35
34 14
21 16
28 13
44 36
39 1
28 2
48 3
49 18
9 2
36 10
48 34
42 8
29 11
45 24
45 15
11 10
20 18
9 9
40 24
18 7
39 2
16 0
46 32
39 13
37 14
36 13
40 10
24 4
8 0
43 17
25 14
50 25

output:

58
1 48
2 48
3 48
4 48
5 48
6 48
7 48
8 48
9 48
10 48
11 48
12 48
13 48
14 48
15 48
16 48
17 48
18 48
19 48
20 48
21 48
22 48
23 48
24 48
25 48
26 48
27 48
28 48
29 48
30 48
31 48
32 48
33 48
34 48
35 48
36 48
37 48
38 48
39 48
40 48
41 48
42 48
43 48
44 48
45 48
46 48
47 48
27 28
29 30
31 32
33 34
...

result:

ok ok, 50 test cases (50 test cases)

Test #8:

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

input:

50
36 12
31 20
48 0
47 23
41 2
28 22
50 5
43 25
47 43
36 4
27 8
46 15
50 0
40 5
44 9
3 1
26 11
13 2
33 3
43 39
46 12
39 36
16 14
41 32
20 13
22 17
14 12
17 16
29 3
35 7
7 5
28 10
47 44
45 21
33 15
43 23
30 6
26 15
47 36
29 25
48 22
21 3
34 20
17 4
44 8
25 22
40 40
29 19
48 33
39 15

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #9:

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

input:

50
50 11
40 22
19 3
48 38
34 19
49 46
8 7
19 6
48 48
21 8
42 35
21 2
35 26
44 32
49 39
18 6
14 4
44 39
40 36
43 24
33 30
46 33
27 14
50 45
49 41
22 4
46 2
26 2
33 20
37 4
41 36
38 10
47 4
15 4
45 26
16 1
18 17
46 37
33 5
25 13
50 16
44 0
40 27
25 12
43 16
43 0
50 31
41 27
23 20
27 26

output:

68
1 50
2 50
3 50
4 50
5 50
6 50
7 50
8 50
9 50
10 50
11 50
12 50
13 50
14 50
15 50
16 50
17 50
18 50
19 50
20 50
21 50
22 50
23 50
24 50
25 50
26 50
27 50
28 50
29 50
30 50
31 50
32 50
33 50
34 50
35 50
36 50
37 50
38 50
39 50
40 50
41 50
42 50
43 50
44 50
45 50
46 50
47 50
48 50
49 50
12 13
14 15
...

result:

ok ok, 50 test cases (50 test cases)

Test #10:

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

input:

50
31 25
33 26
46 18
32 12
30 25
40 26
38 18
41 17
17 9
26 4
50 12
43 11
41 22
38 35
44 14
19 7
32 2
47 9
27 3
42 19
15 8
40 30
49 17
30 2
33 29
43 22
29 28
39 22
29 4
39 11
30 8
15 10
49 29
48 37
40 38
20 3
15 11
33 4
25 21
39 16
15 0
17 1
13 12
46 31
34 32
47 15
50 47
6 6
36 26
10 10

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #11:

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

input:

50
35 33
50 21
37 0
50 4
48 1
40 6
7 2
9 8
32 29
11 2
26 9
49 35
33 6
28 18
42 10
35 28
35 14
49 6
18 12
45 14
5 1
16 16
49 47
43 33
19 13
9 1
20 0
33 32
43 42
39 8
42 27
36 24
6 5
47 42
39 19
48 18
42 41
28 17
38 37
16 3
20 10
39 6
38 32
33 13
25 8
46 39
35 2
42 5
42 37
34 28

output:

-1
63
1 50
2 50
3 50
4 50
5 50
6 50
7 50
8 50
9 50
10 50
11 50
12 50
13 50
14 50
15 50
16 50
17 50
18 50
19 50
20 50
21 50
22 50
23 50
24 50
25 50
26 50
27 50
28 50
29 50
30 50
31 50
32 50
33 50
34 50
35 50
36 50
37 50
38 50
39 50
40 50
41 50
42 50
43 50
44 50
45 50
46 50
47 50
48 50
49 50
22 23
24 ...

result:

ok ok, 50 test cases (50 test cases)

Test #12:

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

input:

50
9 0
20 1
25 15
49 9
16 9
25 2
46 6
50 50
39 26
49 11
37 31
19 11
50 36
35 32
24 15
33 9
20 9
22 6
49 38
39 27
10 4
49 30
21 18
41 11
48 7
19 12
11 9
27 4
19 1
38 23
35 3
40 11
19 2
20 8
47 19
8 5
29 22
12 11
7 1
18 15
35 1
38 0
30 3
24 13
31 16
39 39
42 20
6 4
25 10
27 11

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #13:

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

input:

50
36 29
46 5
42 29
12 12
18 2
29 1
43 9
28 5
35 20
11 6
50 2
45 34
48 27
29 24
18 3
10 3
33 0
45 3
43 36
42 11
31 19
28 27
41 4
33 17
26 5
41 23
36 33
44 21
22 0
11 1
32 22
41 6
47 41
44 31
37 27
29 26
32 19
22 18
45 37
15 12
46 11
32 18
49 28
44 16
50 7
30 17
10 0
10 7
40 2
39 21

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #14:

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

input:

50
44 34
49 42
49 34
43 19
15 2
36 0
49 12
37 11
39 30
28 16
30 18
40 3
13 11
14 6
48 30
33 1
28 25
27 9
21 14
48 23
42 17
36 16
29 0
50 40
30 14
39 33
42 1
11 3
44 40
21 15
25 7
16 4
21 1
44 2
39 31
27 5
42 38
48 24
27 16
23 18
5 4
26 19
30 15
19 0
46 21
28 7
34 16
8 1
45 36
44 27

output:

48
1 44
2 44
3 44
4 44
5 44
6 44
7 44
8 44
9 44
10 44
11 44
12 44
13 44
14 44
15 44
16 44
17 44
18 44
19 44
20 44
21 44
22 44
23 44
24 44
25 44
26 44
27 44
28 44
29 44
30 44
31 44
32 44
33 44
34 44
35 44
36 44
37 44
38 44
39 44
40 44
41 44
42 44
43 44
35 36
37 38
39 40
41 42
43 42
51
1 49
2 49
3 49
...

result:

ok ok, 50 test cases (50 test cases)

Test #15:

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

input:

50
23 1
37 24
37 26
31 17
19 14
46 13
38 25
32 16
24 14
31 31
34 22
49 14
23 16
30 20
40 17
20 15
46 20
34 1
49 3
37 21
38 7
22 21
24 0
34 11
50 46
35 10
38 31
33 33
5 2
38 17
48 20
40 25
23 10
46 24
46 3
39 3
43 18
38 12
50 49
29 5
23 22
32 27
21 0
31 13
23 8
38 13
22 2
30 26
47 18
47 34

output:

33
1 23
2 23
3 23
4 23
5 23
6 23
7 23
8 23
9 23
10 23
11 23
12 23
13 23
14 23
15 23
16 23
17 23
18 23
19 23
20 23
21 23
22 23
2 3
4 5
6 7
8 9
10 11
12 13
14 15
16 17
18 19
20 21
22 21
42
1 37
2 37
3 37
4 37
5 37
6 37
7 37
8 37
9 37
10 37
11 37
12 37
13 37
14 37
15 37
16 37
17 37
18 37
19 37
20 37
21...

result:

ok ok, 50 test cases (50 test cases)

Test #16:

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

input:

50
37 9
48 2
31 6
38 21
18 13
33 19
37 29
16 6
46 0
15 14
49 24
10 9
11 5
28 3
50 9
23 13
39 5
45 7
33 23
15 1
24 7
15 9
24 5
47 28
27 7
47 40
36 25
42 12
50 23
39 25
47 37
28 15
37 5
21 5
41 9
39 29
36 19
48 21
22 8
49 2
41 37
37 34
41 5
45 29
32 23
50 37
41 26
47 17
39 38
30 23

output:

50
1 37
2 37
3 37
4 37
5 37
6 37
7 37
8 37
9 37
10 37
11 37
12 37
13 37
14 37
15 37
16 37
17 37
18 37
19 37
20 37
21 37
22 37
23 37
24 37
25 37
26 37
27 37
28 37
29 37
30 37
31 37
32 37
33 37
34 37
35 37
36 37
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 35
70
1 4...

result:

ok ok, 50 test cases (50 test cases)

Test #17:

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

input:

50
25 5
22 11
19 10
29 15
30 30
23 11
49 44
23 23
44 42
41 1
40 16
26 10
3 3
28 11
41 16
42 15
33 27
5 0
39 18
31 12
28 8
38 27
35 23
28 14
35 12
6 3
34 2
46 14
35 31
50 33
17 8
43 2
46 9
47 45
43 34
26 14
34 17
32 13
42 22
7 6
24 16
21 20
23 4
26 23
48 40
30 1
49 7
31 26
29 17
50 8

output:

34
1 25
2 25
3 25
4 25
5 25
6 25
7 25
8 25
9 25
10 25
11 25
12 25
13 25
14 25
15 25
16 25
17 25
18 25
19 25
20 25
21 25
22 25
23 25
24 25
6 7
8 9
10 11
12 13
14 15
16 17
18 19
20 21
22 23
24 23
26
1 22
2 22
3 22
4 22
5 22
6 22
7 22
8 22
9 22
10 22
11 22
12 22
13 22
14 22
15 22
16 22
17 22
18 22
19 2...

result:

ok ok, 50 test cases (50 test cases)

Test #18:

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

input:

50
10 1
47 2
37 15
50 13
22 3
45 35
11 11
45 19
20 4
36 11
24 1
44 20
12 10
13 6
42 13
45 22
34 9
50 42
47 26
41 30
45 31
14 9
47 24
34 0
29 9
19 19
48 47
9 6
44 43
40 39
41 8
15 5
30 24
43 29
41 41
7 3
38 20
32 28
42 6
12 9
48 15
45 32
22 7
34 27
31 24
36 23
44 25
38 26
16 8
22 1

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #19:

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

input:

50
50 38
31 7
32 25
12 6
34 4
28 24
37 23
41 12
35 6
40 32
24 23
39 35
40 12
12 8
41 38
29 2
30 19
37 28
29 21
27 22
33 21
46 19
45 1
12 2
26 3
45 16
43 40
43 4
36 36
48 17
17 2
45 11
46 30
16 12
17 7
8 3
44 1
50 15
43 21
12 5
40 20
42 9
14 0
42 36
19 17
26 25
44 15
16 15
36 35
48 42

output:

55
1 50
2 50
3 50
4 50
5 50
6 50
7 50
8 50
9 50
10 50
11 50
12 50
13 50
14 50
15 50
16 50
17 50
18 50
19 50
20 50
21 50
22 50
23 50
24 50
25 50
26 50
27 50
28 50
29 50
30 50
31 50
32 50
33 50
34 50
35 50
36 50
37 50
38 50
39 50
40 50
41 50
42 50
43 50
44 50
45 50
46 50
47 50
48 50
49 50
39 40
41 42
...

result:

ok ok, 50 test cases (50 test cases)

Test #20:

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

input:

50
11 4
48 9
40 28
14 7
26 6
20 6
47 0
27 0
33 12
50 22
47 16
46 27
21 21
36 1
24 20
42 7
50 17
41 31
40 19
39 23
13 9
34 25
34 29
5 5
41 39
31 4
32 9
45 2
49 27
30 9
21 7
24 18
25 20
41 7
25 4
42 32
43 12
7 4
37 18
35 15
45 28
30 4
35 9
46 40
18 14
37 1
19 8
48 35
22 13
38 36

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #21:

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

input:

50
36 21
18 10
49 36
26 7
4 0
23 21
36 31
13 10
30 16
32 32
23 6
32 4
45 45
32 17
30 7
50 14
46 43
28 23
47 39
34 7
44 30
42 23
37 19
44 11
25 0
17 15
46 38
49 13
7 7
34 13
20 20
41 13
49 40
42 14
22 9
47 3
25 16
23 12
50 1
39 20
12 3
46 34
41 14
50 27
50 48
35 22
40 14
9 7
36 30
24 21

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #22:

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

input:

50
12 7
44 23
41 25
31 14
32 14
27 20
24 9
49 4
27 1
49 22
41 15
37 8
20 16
24 17
26 18
34 5
44 10
42 3
32 3
50 39
28 28
45 18
28 12
13 8
38 4
50 35
33 8
37 36
49 26
44 35
35 21
49 5
47 22
29 20
23 15
28 0
29 27
47 13
21 10
19 18
38 8
33 25
39 0
32 31
27 19
39 34
38 34
43 31
44 22
25 9

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #23:

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

input:

50
34 3
20 2
42 0
38 3
37 37
36 2
48 31
29 8
44 41
50 28
31 0
32 30
36 22
35 27
43 20
43 6
50 3
21 11
40 23
49 21
40 33
27 21
50 18
22 16
33 18
32 6
25 18
14 1
50 44
36 7
38 9
36 3
15 15
34 21
36 5
42 26
44 29
44 24
33 24
48 4
44 38
39 24
42 24
24 8
28 20
47 6
11 0
38 29
40 18
43 15

output:

48
1 34
2 34
3 34
4 34
5 34
6 34
7 34
8 34
9 34
10 34
11 34
12 34
13 34
14 34
15 34
16 34
17 34
18 34
19 34
20 34
21 34
22 34
23 34
24 34
25 34
26 34
27 34
28 34
29 34
30 34
31 34
32 34
33 34
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
28
1 20
2 20
3 20
4 20
5...

result:

ok ok, 50 test cases (50 test cases)

Test #24:

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

input:

50
19 15
36 14
16 11
21 19
37 10
48 19
41 10
23 17
48 43
29 23
20 5
17 13
38 6
44 18
12 0
33 31
47 1
25 3
44 5
30 12
26 16
46 26
17 6
22 12
17 5
35 24
14 3
38 11
47 29
48 44
43 43
35 17
48 28
34 10
41 24
47 5
35 18
48 5
13 13
14 10
38 24
25 1
36 34
17 12
24 2
38 15
13 7
28 21
45 0
43 27

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #25:

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

input:

50
32 10
33 7
48 8
33 2
49 0
42 21
29 7
15 3
37 33
26 8
15 7
41 29
29 12
40 9
27 24
44 44
34 34
38 19
41 21
42 16
32 8
42 40
39 28
46 42
21 13
17 3
31 23
46 45
41 18
25 17
44 19
34 31
22 19
13 3
30 22
32 11
36 9
45 33
20 12
45 23
47 27
22 15
31 3
45 12
26 13
49 48
49 16
49 33
49 1
35 25

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #26:

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

input:

50
31 8
38 30
35 4
26 22
34 24
18 8
3 0
46 7
24 3
39 7
21 6
29 6
46 1
31 28
14 2
46 22
6 1
41 33
8 6
44 6
10 8
37 7
19 16
38 14
48 45
49 32
43 10
37 6
20 11
46 36
47 21
40 37
23 7
43 32
14 13
48 14
36 15
7 0
28 19
36 32
47 25
50 30
16 5
15 6
24 19
36 18
45 9
45 13
40 7
49 19

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #27:

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

input:

50
31 1
17 17
27 25
35 30
30 28
50 43
34 26
45 20
21 4
40 29
17 14
49 45
14 14
43 28
40 8
37 22
23 5
49 37
21 12
10 2
23 2
46 29
43 5
41 3
14 5
28 9
34 18
16 7
50 26
18 1
43 35
21 17
42 31
48 32
17 11
47 7
34 6
46 17
47 47
18 18
49 43
44 4
49 25
13 0
50 6
30 0
43 37
32 5
4 4
32 20

output:

45
1 31
2 31
3 31
4 31
5 31
6 31
7 31
8 31
9 31
10 31
11 31
12 31
13 31
14 31
15 31
16 31
17 31
18 31
19 31
20 31
21 31
22 31
23 31
24 31
25 31
26 31
27 31
28 31
29 31
30 31
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 29
-1
-1
36
1 35
2 35
3 35
4 35
5 35
6 35
7 35
...

result:

ok ok, 50 test cases (50 test cases)

Test #28:

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

input:

50
45 42
26 21
48 46
48 13
13 5
24 10
37 3
26 24
11 8
11 7
30 11
22 10
50 29
41 34
31 29
18 5
33 22
40 1
39 32
5 3
39 17
46 46
31 30
9 3
45 38
40 31
45 40
12 1
20 17
23 19
30 27
6 0
36 28
6 2
42 18
3 2
4 3
23 9
38 2
40 15
43 7
42 2
27 6
8 8
48 25
35 29
19 5
45 10
31 11
37 12

output:

45
1 45
2 45
3 45
4 45
5 45
6 45
7 45
8 45
9 45
10 45
11 45
12 45
13 45
14 45
15 45
16 45
17 45
18 45
19 45
20 45
21 45
22 45
23 45
24 45
25 45
26 45
27 45
28 45
29 45
30 45
31 45
32 45
33 45
34 45
35 45
36 45
37 45
38 45
39 45
40 45
41 45
42 45
43 45
44 45
43 44
27
1 26
2 26
3 26
4 26
5 26
6 26
7 2...

result:

ok ok, 50 test cases (50 test cases)

Test #29:

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

input:

50
8 4
22 5
27 12
40 13
40 21
41 0
37 16
50 20
36 27
36 6
9 5
4 2
40 34
47 30
44 26
25 11
48 11
50 34
24 6
18 4
47 12
37 20
30 13
16 13
48 39
27 2
16 10
49 31
45 43
30 29
46 25
25 23
32 7
23 3
26 0
39 4
38 1
30 5
27 13
43 14
45 4
32 21
21 9
35 35
24 11
44 37
45 41
18 0
20 14
13 1

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #30:

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

input:

50
38 5
37 25
27 27
24 24
37 32
20 19
25 6
44 17
49 15
50 19
32 24
25 25
35 8
32 15
38 16
23 14
41 20
47 20
31 5
40 4
45 27
26 1
15 13
31 18
44 28
38 33
29 16
44 13
43 38
46 23
13 4
42 34
30 21
31 10
32 1
34 12
37 13
42 4
22 14
48 6
34 8
33 28
28 6
42 25
42 30
31 22
35 5
37 35
50 24
29 18

output:

53
1 38
2 38
3 38
4 38
5 38
6 38
7 38
8 38
9 38
10 38
11 38
12 38
13 38
14 38
15 38
16 38
17 38
18 38
19 38
20 38
21 38
22 38
23 38
24 38
25 38
26 38
27 38
28 38
29 38
30 38
31 38
32 38
33 38
34 38
35 38
36 38
37 38
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 3...

result:

ok ok, 50 test cases (50 test cases)

Test #31:

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

input:

20
43 30
49 8
48 12
38 28
47 11
42 39
48 10
47 31
39 10
22 22
19 4
49 10
35 11
45 6
47 35
38 22
46 35
44 3
39 14
27 17

output:

48
1 43
2 43
3 43
4 43
5 43
6 43
7 43
8 43
9 43
10 43
11 43
12 43
13 43
14 43
15 43
16 43
17 43
18 43
19 43
20 43
21 43
22 43
23 43
24 43
25 43
26 43
27 43
28 43
29 43
30 43
31 43
32 43
33 43
34 43
35 43
36 43
37 43
38 43
39 43
40 43
41 43
42 43
31 32
33 34
35 36
37 38
39 40
41 42
68
1 49
2 49
3 49
...

result:

ok ok, 20 test cases (20 test cases)

Test #32:

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

input:

1
3 3

output:

-1

result:

ok ok, 1 test cases (1 test case)

Test #33:

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

input:

50
5 5
10 10
14 14
15 15
36 34
14 12
22 20
25 23
38 36
48 48
40 40
21 19
8 6
17 17
49 47
11 9
43 41
8 8
46 44
18 18
48 46
49 49
43 43
47 45
20 18
6 4
20 20
36 36
50 50
7 5
35 33
28 28
29 29
30 28
28 26
4 2
39 37
23 21
50 48
12 12
38 38
15 13
4 4
13 13
19 19
5 3
45 45
16 14
26 26
31 29

output:

-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

result:

ok ok, 50 test cases (50 test cases)

Test #34:

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

input:

46
41 39
17 15
27 25
13 11
42 40
29 27
37 37
45 43
27 27
10 8
44 44
7 7
35 35
22 22
31 31
26 24
34 34
24 24
47 47
21 21
37 35
42 42
24 22
33 33
39 39
16 16
3 3
32 30
9 9
23 23
3 1
46 46
11 11
18 16
9 7
40 38
32 32
34 32
33 31
12 10
25 25
30 30
6 6
19 17
41 41
44 42

output:

-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

result:

ok ok, 46 test cases (46 test cases)

Test #35:

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

input:

50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50
50 50

output:

-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

result:

ok ok, 50 test cases (50 test cases)

Test #36:

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

input:

50
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49
50 49

output:

49
1 50
2 50
3 50
4 50
5 50
6 50
7 50
8 50
9 50
10 50
11 50
12 50
13 50
14 50
15 50
16 50
17 50
18 50
19 50
20 50
21 50
22 50
23 50
24 50
25 50
26 50
27 50
28 50
29 50
30 50
31 50
32 50
33 50
34 50
35 50
36 50
37 50
38 50
39 50
40 50
41 50
42 50
43 50
44 50
45 50
46 50
47 50
48 50
49 50
49
1 50
2 50...

result:

ok ok, 50 test cases (50 test cases)

Test #37:

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

input:

50
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0
50 0

output:

74
1 50
2 50
3 50
4 50
5 50
6 50
7 50
8 50
9 50
10 50
11 50
12 50
13 50
14 50
15 50
16 50
17 50
18 50
19 50
20 50
21 50
22 50
23 50
24 50
25 50
26 50
27 50
28 50
29 50
30 50
31 50
32 50
33 50
34 50
35 50
36 50
37 50
38 50
39 50
40 50
41 50
42 50
43 50
44 50
45 50
46 50
47 50
48 50
49 50
1 2
3 4
5 6
...

result:

ok ok, 50 test cases (50 test cases)

Test #38:

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

input:

50
8 0
4 0
26 0
17 0
14 0
21 0
7 0
6 0
20 0
46 0
21 0
3 0
30 0
23 0
42 0
17 0
33 0
28 0
45 0
46 0
11 0
44 0
14 0
29 0
24 0
13 0
12 0
19 0
46 0
22 0
45 0
43 0
50 0
3 0
10 0
19 0
49 0
4 0
31 0
45 0
9 0
30 0
16 0
15 0
28 0
8 0
31 0
3 0
36 0
48 0

output:

11
1 8
2 8
3 8
4 8
5 8
6 8
7 8
1 2
3 4
5 6
7 6
4
1 2
2 3
3 4
4 1
38
1 26
2 26
3 26
4 26
5 26
6 26
7 26
8 26
9 26
10 26
11 26
12 26
13 26
14 26
15 26
16 26
17 26
18 26
19 26
20 26
21 26
22 26
23 26
24 26
25 26
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 24
24
1 17
2 17
3 17
4 17...

result:

ok ok, 50 test cases (50 test cases)

Test #39:

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

input:

50
23 23
24 24
25 25
36 36
20 20
31 31
45 45
25 25
24 24
14 14
49 49
40 40
24 24
17 17
29 29
28 28
29 29
4 4
44 44
37 37
36 36
10 10
29 29
23 23
30 30
9 9
35 35
12 12
49 49
12 12
22 22
46 46
5 5
48 48
33 33
46 46
7 7
39 39
17 17
32 32
9 9
8 8
44 44
28 28
32 32
29 29
8 8
31 31
5 5
3 3

output:

-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

result:

ok ok, 50 test cases (50 test cases)

Test #40:

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

input:

50
47 46
8 7
37 36
13 12
50 49
27 26
17 16
18 17
3 2
17 16
31 30
43 42
41 40
22 21
23 22
22 21
16 15
10 9
38 37
21 20
6 5
33 32
14 13
48 47
32 31
3 2
36 35
47 46
3 2
44 43
49 48
16 15
43 42
45 44
50 49
7 6
7 6
41 40
40 39
9 8
26 25
25 24
9 8
32 31
12 11
9 8
45 44
10 9
8 7
8 7

output:

46
1 47
2 47
3 47
4 47
5 47
6 47
7 47
8 47
9 47
10 47
11 47
12 47
13 47
14 47
15 47
16 47
17 47
18 47
19 47
20 47
21 47
22 47
23 47
24 47
25 47
26 47
27 47
28 47
29 47
30 47
31 47
32 47
33 47
34 47
35 47
36 47
37 47
38 47
39 47
40 47
41 47
42 47
43 47
44 47
45 47
46 47
7
1 8
2 8
3 8
4 8
5 8
6 8
7 8
...

result:

ok ok, 50 test cases (50 test cases)

Test #41:

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

input:

50
49 47
10 8
27 25
12 10
40 38
38 36
11 9
12 10
21 19
7 5
30 28
20 18
34 32
12 10
14 12
5 3
12 10
39 37
12 10
50 48
4 2
30 28
10 8
19 17
47 45
11 9
48 46
38 36
7 5
29 27
7 5
25 23
25 23
37 35
49 47
34 32
5 3
10 8
47 45
23 21
17 15
37 35
25 23
22 20
6 4
38 36
42 40
14 12
33 31
13 11

output:

-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

result:

ok ok, 50 test cases (50 test cases)

Test #42:

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

input:

50
34 31
20 17
3 0
33 30
34 31
32 29
18 15
29 26
19 16
29 26
38 35
30 27
47 44
28 25
13 10
38 35
23 20
17 14
23 20
28 25
43 40
37 34
10 7
10 7
21 18
18 15
31 28
30 27
47 44
42 39
35 32
9 6
7 4
33 30
23 20
19 16
34 31
30 27
33 30
21 18
7 4
30 27
41 38
29 26
16 13
33 30
13 10
30 27
44 41
43 40

output:

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

result:

ok ok, 50 test cases (50 test cases)

Test #43:

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

input:

50
29 14
48 32
15 2
33 24
28 8
27 10
33 13
45 45
31 0
27 20
12 12
43 15
16 15
8 0
25 18
3 0
7 1
12 7
16 2
45 33
45 5
16 7
12 3
36 10
44 4
12 7
4 3
15 13
12 0
25 17
49 10
25 21
38 26
49 8
14 13
26 9
19 8
45 21
34 31
26 19
45 36
5 4
7 7
4 0
27 1
50 24
38 5
32 1
9 4
15 14

output:

35
1 29
2 29
3 29
4 29
5 29
6 29
7 29
8 29
9 29
10 29
11 29
12 29
13 29
14 29
15 29
16 29
17 29
18 29
19 29
20 29
21 29
22 29
23 29
24 29
25 29
26 29
27 29
28 29
15 16
17 18
19 20
21 22
23 24
25 26
27 28
55
1 48
2 48
3 48
4 48
5 48
6 48
7 48
8 48
9 48
10 48
11 48
12 48
13 48
14 48
15 48
16 48
17 48
...

result:

ok ok, 50 test cases (50 test cases)

Test #44:

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

input:

50
24 10
6 3
29 15
34 14
37 1
33 29
49 5
22 0
7 1
41 32
47 24
20 11
39 33
23 12
48 15
20 9
14 4
19 16
11 4
48 11
20 9
24 8
11 3
48 38
35 18
30 8
24 7
13 9
20 11
14 0
43 1
18 2
48 33
16 0
45 18
21 13
48 7
47 3
24 13
34 2
44 8
19 16
4 0
31 0
14 6
37 20
42 1
40 11
47 44
14 8

output:

30
1 24
2 24
3 24
4 24
5 24
6 24
7 24
8 24
9 24
10 24
11 24
12 24
13 24
14 24
15 24
16 24
17 24
18 24
19 24
20 24
21 24
22 24
23 24
11 12
13 14
15 16
17 18
19 20
21 22
23 22
6
1 6
2 6
3 6
4 6
5 6
4 5
35
1 29
2 29
3 29
4 29
5 29
6 29
7 29
8 29
9 29
10 29
11 29
12 29
13 29
14 29
15 29
16 29
17 29
18 2...

result:

ok ok, 50 test cases (50 test cases)