QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#27856#2619. Diameter TwoGeothermal#AC ✓3ms3716kbC++1.5kb2022-04-11 02:40:042022-04-29 07:49:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-29 07:49:56]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3716kb
  • [2022-04-11 02:40:04]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b) - 1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; i--)

#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(), x.end()

const char nl = '\n';

void solve() {
	int N, K; cin >> N >> K;
	if (K == N || K == N-2) {
		cout << -1 << nl; return;
	}
	if (K == 0 && N <= 5) {
		cout << N << nl;
		F0R(i, N) {
			cout << i+1 << " " << (i+1)%N+1 << nl;
		}
		return;
	}
	if (K == 0 && N == 6) {
		cout << 7 << nl;
		vpi eds = {{1, 4}, {1, 5}, {1, 6}, {2, 3}, {2, 5}, {2, 6}, {3, 4}};
		for (auto &a : eds) {
			cout << a.f << " " << a.s << nl;
		}
		return;
	}
	vpi eds;
	F0R(i, N) {
		if (i != K) eds.pb({i, K});
	}
	FOR(i, K+1, N) {
		if ((i-K-1) % 2 == 0) {
			if (i == N-1) {
				eds.pb({i, i-1});
			} else eds.pb({i, i+1});
		}
	}

	cout << sz(eds) << nl;
	for (auto &a : eds) {
		cout << a.f+1 << " " << a.s+1 << nl;
	}
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int T; cin >> T;
	while(T--) {
		solve();
	}

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3696kb

input:

3
3 0
5 2
6 6

output:

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

result:

ok ok, 3 test cases (3 test cases)

Test #2:

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

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

result:

ok ok, 39 test cases (39 test cases)

Test #3:

score: 0
Accepted
time: 3ms
memory: 3560kb

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

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 16
2 16
3 16
4 16
5 16
6 16
7 16
8 16
9 16
10 16
11 16
12 16
13 16
14 16
15 16
17 16
18 16
19 16
20 16
21 16
22 16
23 16
17 18
19 20
21 22
23 22
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: 3ms
memory: 3716kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #6:

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

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 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
21 20
22 20
23 20
24 20
25 20
21 22
23 24
25 24
46
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
...

result:

ok ok, 50 test cases (50 test cases)

Test #7:

score: 0
Accepted
time: 3ms
memory: 3632kb

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 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
28 27
29 27
30 27
31 27
32 27
33 27
34 27
35 27
36 27
37 27
38 27
39 27
40 27
41 27
42 27
43 27
44 27
45 27
46 27
47 27
48 27
28 29
30 31
32 33
34 35
...

result:

ok ok, 50 test cases (50 test cases)

Test #8:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #9:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #10:

score: 0
Accepted
time: 3ms
memory: 3556kb

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 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
27 26
28 26
29 26
30 26
31 26
27 28
29 30
31 30
35
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
...

result:

ok ok, 50 test cases (50 test cases)

Test #11:

score: 0
Accepted
time: 3ms
memory: 3556kb

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 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
23 22
24 22
25 22
26 22
27 22
28 22
29 22
30 22
31 22
32 22
33 22
34 22
35 22
36 22
37 22
38 22
39 22
40 22
41 22
42 22
43 22
44 22
45 22
46 22
47 22
48 22
49 22
50 22
23 24
25 ...

result:

ok ok, 50 test cases (50 test cases)

Test #12:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #13:

score: 0
Accepted
time: 3ms
memory: 3664kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #14:

score: 0
Accepted
time: 3ms
memory: 3508kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #15:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #16:

score: 0
Accepted
time: 3ms
memory: 3564kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #17:

score: 0
Accepted
time: 3ms
memory: 3612kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #18:

score: 0
Accepted
time: 3ms
memory: 3712kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #19:

score: 0
Accepted
time: 3ms
memory: 3556kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #20:

score: 0
Accepted
time: 3ms
memory: 3648kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #21:

score: 0
Accepted
time: 3ms
memory: 3520kb

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 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
23 22
24 22
25 22
26 22
27 22
28 22
29 22
30 22
31 22
32 22
33 22
34 22
35 22
36 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
21
1 11
2 11
3 11
4 11
5 11
6 11
7 11
8 11
9 11
10 11
...

result:

ok ok, 50 test cases (50 test cases)

Test #22:

score: 0
Accepted
time: 3ms
memory: 3652kb

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 8
2 8
3 8
4 8
5 8
6 8
7 8
9 8
10 8
11 8
12 8
9 10
11 12
53
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
25 24
26 24
27 24
28 24
29 24
30 24
31 24
32 24
33 24
34 24
35 24
36 24
37 24
38 24
39 24
40 24
41 24
42 24...

result:

ok ok, 50 test cases (50 test cases)

Test #23:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #24:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #25:

score: 0
Accepted
time: 3ms
memory: 3508kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #26:

score: 0
Accepted
time: 3ms
memory: 3560kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #27:

score: 0
Accepted
time: 3ms
memory: 3612kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #28:

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

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 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
44 43
45 43
44 45
27
1 22
2 22
3 22
4 22
5 22
6 22
7 2...

result:

ok ok, 50 test cases (50 test cases)

Test #29:

score: 0
Accepted
time: 3ms
memory: 3572kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #30:

score: 0
Accepted
time: 3ms
memory: 3560kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #31:

score: 0
Accepted
time: 3ms
memory: 3704kb

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 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
32 31
33 31
34 31
35 31
36 31
37 31
38 31
39 31
40 31
41 31
42 31
43 31
32 33
34 35
36 37
38 39
40 41
42 43
68
1 9
2 9
3 9
4 9...

result:

ok ok, 20 test cases (20 test cases)

Test #32:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

1
3 3

output:

-1

result:

ok ok, 1 test cases (1 test case)

Test #33:

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

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

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

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: 2ms
memory: 3668kb

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: 3ms
memory: 3716kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #38:

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

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

result:

ok ok, 50 test cases (50 test cases)

Test #39:

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

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: 1ms
memory: 3656kb

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: 3ms
memory: 3648kb

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: 3ms
memory: 3648kb

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 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
33 32
34 32
33 34
20
1 18
2 18
3 18
4 18
5 18
6 18
7 18
8 18
9 18
10 18
11 18
12 18
13 18
14 18
15 18
16 18
17 18
19 18
...

result:

ok ok, 50 test cases (50 test cases)

Test #43:

score: 0
Accepted
time: 3ms
memory: 3636kb

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

result:

ok ok, 50 test cases (50 test cases)

Test #44:

score: 0
Accepted
time: 3ms
memory: 3576kb

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

result:

ok ok, 50 test cases (50 test cases)