QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#121725#2619. Diameter TwoBZJRNAC ✓1ms1752kbC++14419b2023-07-08 19:20:442023-07-08 19:20:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 19:20:47]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:1752kb
  • [2023-07-08 19:20:44]
  • 提交

answer

#include<stdio.h>
int t,n,k,i;
int main(){
	for(scanf("%d",&t);t;--t){
		scanf("%d%d",&n,&k);
		if(n==k||n-k==2)puts("-1");
		else if(n>6||k){
			for(printf("%d\n",n-1+(n-k)/2),i=n-1;i;--i)printf("%d %d\n",n,i);
			for(i=n-1;i>=(n+k+1)/2&&n-k>1;--i)printf("%d %d\n",i,i-(n-k-1)/2);
		}
		else printf("%d\n1 2\n2 3\n3 ",n+(n>5)),n>4?puts("4\n4 5"),puts(n<6?"5 1":"5 1\n1 6\n6 3"):puts(n<4?"1":"4\n4 1");
	}
}

详细

Test #1:

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

input:

3
3 0
5 2
6 6

output:

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

result:

ok ok, 3 test cases (3 test cases)

Test #2:

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

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
3 2
3 1
-1
4
1 2
2 3
3 4
4 1
4
4 3
4 2
4 1
3 2
-1
3
4 3
4 2
4 1
-1
5
1 2
2 3
3 4
4 5
5 1
6
5 4
5 3
5 2
5 1
4 3
3 2
5
5 4
5 3
5 2
5 1
4 3
-1
4
5 4
5 3
5 2
5 1
-1
7
1 2
2 3
3 4
4 5
5 1
1 6
6 3
7
6 5
6 4
6 3
6 2
6 1
5 3
4 2
7
6 5
6 4
6 3
6 2
6 1
5 4
4 3
6
6 5
6 4
6 3
6 2
6 1
5 4
-1
5...

result:

ok ok, 39 test cases (39 test cases)

Test #3:

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

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

result:

ok ok, 39 test cases (39 test cases)

Test #4:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #5:

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

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
27 26
27 25
27 24
27 23
27 22
27 21
27 20
27 19
27 18
27 17
27 16
27 15
27 14
27 13
27 12
27 11
27 10
27 9
27 8
27 7
27 6
27 5
27 4
27 3
27 2
27 1
26 18
25 17
24 16
23 15
22 14
21 13
20 12
19 11
10
8 7
8 6
8 5
8 4
8 3
8 2
8 1
7 5
6 4
5 3
66
46 45
46 44
46 43
46 42
46 41
46 40
46 39
46 38
46 37
46...

result:

ok ok, 50 test cases (50 test cases)

Test #6:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #7:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #8:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #9:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #10:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #11:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #12:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #13:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #14:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #15:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #16:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #17:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #18:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #19:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #20:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #21:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #22:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #23:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #24:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #25:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #26:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #27:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #28:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #29:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #30:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #31:

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

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

result:

ok ok, 20 test cases (20 test cases)

Test #32:

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

input:

1
3 3

output:

-1

result:

ok ok, 1 test cases (1 test case)

Test #33:

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

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: 1504kb

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: 1484kb

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: 0ms
memory: 1488kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #37:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #38:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #39:

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

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: 1744kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #41:

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

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: 1744kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #43:

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

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
29 28
29 27
29 26
29 25
29 24
29 23
29 22
29 21
29 20
29 19
29 18
29 17
29 16
29 15
29 14
29 13
29 12
29 11
29 10
29 9
29 8
29 7
29 6
29 5
29 4
29 3
29 2
29 1
28 21
27 20
26 19
25 18
24 17
23 16
22 15
55
48 47
48 46
48 45
48 44
48 43
48 42
48 41
48 40
48 39
48 38
48 37
48 36
48 35
48 34
48 33
48 ...

result:

ok ok, 50 test cases (50 test cases)

Test #44:

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

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

result:

ok ok, 50 test cases (50 test cases)