QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#162738#5209. King's Puzzlekaruna#AC ✓7ms4008kbC++171.0kb2023-09-03 16:11:212023-09-03 16:11:21

Judging History

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

  • [2023-09-03 16:11:21]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:4008kb
  • [2023-09-03 16:11:21]
  • 提交

answer

#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);
	
	int n, k; cin >> n >> k;
	if(k == 1)
	{
		if(n == 1) return !(cout << "YES\n0");
		else if(n == 2) return !(cout << "YES\n1\n1 2");
		else
		{
			cout << "YES\n";
			cout << n << '\n';
			for(int i = 0; i < n; ++i) cout << i + 1 << ' ' << (i + 1) % n + 1 << '\n';
			return 0;
		}
	}

	if(n < k + 1) return !(cout << "NO");

	int ord[k + 1];
	int t = (k + 1) / 2;
	for(int i = 0; i < t; ++i) ord[i] = i + 1;
	for(int i = t; i <= k; ++i) ord[i] = i;

	vector<pii> V;
	for(int i = k; i >= 0; --i)
	{
		for(int j = 1; j <= ord[i]; ++j)
		{
			V.push_back({i, i - j});
			--ord[i - j];
		}
		ord[i] = 0;
	}

	int pr = 0;
	for(int i = k + 1; i < n; ++i)
	{
		V.push_back({pr, i});
		pr = i;
	}

	cout << "YES\n";
	cout << V.size() << '\n';
	for(auto [x, y] : V) cout << x + 1 << ' ' << y + 1 << '\n';
}

详细

Test #1:

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

input:

5 2

output:

YES
4
3 2
3 1
1 4
4 5

result:

ok n = 5, k = 2: nice job dude

Test #2:

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

input:

4 1

output:

YES
4
1 2
2 3
3 4
4 1

result:

ok n = 4, k = 1: nice job dude

Test #3:

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

input:

11 1

output:

YES
11
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 1

result:

ok n = 11, k = 1: nice job dude

Test #4:

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

input:

11 2

output:

YES
10
3 2
3 1
1 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11

result:

ok n = 11, k = 2: nice job dude

Test #5:

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

input:

11 3

output:

YES
11
4 3
4 2
4 1
3 2
1 5
5 6
6 7
7 8
8 9
9 10
10 11

result:

ok n = 11, k = 3: nice job dude

Test #6:

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

input:

11 9

output:

YES
26
10 9
10 8
10 7
10 6
10 5
10 4
10 3
10 2
10 1
9 8
9 7
9 6
9 5
9 4
9 3
9 2
8 7
8 6
8 5
8 4
8 3
7 6
7 5
7 4
6 5
1 11

result:

ok n = 11, k = 9: nice job dude

Test #7:

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

input:

11 10

output:

YES
30
11 10
11 9
11 8
11 7
11 6
11 5
11 4
11 3
11 2
11 1
10 9
10 8
10 7
10 6
10 5
10 4
10 3
10 2
9 8
9 7
9 6
9 5
9 4
9 3
8 7
8 6
8 5
8 4
7 6
7 5

result:

ok n = 11, k = 10: nice job dude

Test #8:

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

input:

11 11

output:

NO

result:

ok n = 11, k = 11: nice job dude

Test #9:

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

input:

53 1

output:

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

result:

ok n = 53, k = 1: nice job dude

Test #10:

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

input:

53 2

output:

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

result:

ok n = 53, k = 2: nice job dude

Test #11:

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

input:

53 3

output:

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

result:

ok n = 53, k = 3: nice job dude

Test #12:

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

input:

53 51

output:

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

result:

ok n = 53, k = 51: nice job dude

Test #13:

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

input:

53 52

output:

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

result:

ok n = 53, k = 52: nice job dude

Test #14:

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

input:

53 53

output:

NO

result:

ok n = 53, k = 53: nice job dude

Test #15:

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

input:

267 1

output:

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

result:

ok n = 267, k = 1: nice job dude

Test #16:

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

input:

267 2

output:

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

result:

ok n = 267, k = 2: nice job dude

Test #17:

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

input:

267 3

output:

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

result:

ok n = 267, k = 3: nice job dude

Test #18:

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

input:

267 265

output:

YES
17690
266 265
266 264
266 263
266 262
266 261
266 260
266 259
266 258
266 257
266 256
266 255
266 254
266 253
266 252
266 251
266 250
266 249
266 248
266 247
266 246
266 245
266 244
266 243
266 242
266 241
266 240
266 239
266 238
266 237
266 236
266 235
266 234
266 233
266 232
266 231
266 230
26...

result:

ok n = 267, k = 265: nice job dude

Test #19:

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

input:

267 266

output:

YES
17822
267 266
267 265
267 264
267 263
267 262
267 261
267 260
267 259
267 258
267 257
267 256
267 255
267 254
267 253
267 252
267 251
267 250
267 249
267 248
267 247
267 246
267 245
267 244
267 243
267 242
267 241
267 240
267 239
267 238
267 237
267 236
267 235
267 234
267 233
267 232
267 231
26...

result:

ok n = 267, k = 266: nice job dude

Test #20:

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

input:

267 267

output:

NO

result:

ok n = 267, k = 267: nice job dude

Test #21:

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

input:

499 1

output:

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

result:

ok n = 499, k = 1: nice job dude

Test #22:

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

input:

499 2

output:

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

result:

ok n = 499, k = 2: nice job dude

Test #23:

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

input:

499 3

output:

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

result:

ok n = 499, k = 3: nice job dude

Test #24:

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

input:

499 497

output:

YES
62002
498 497
498 496
498 495
498 494
498 493
498 492
498 491
498 490
498 489
498 488
498 487
498 486
498 485
498 484
498 483
498 482
498 481
498 480
498 479
498 478
498 477
498 476
498 475
498 474
498 473
498 472
498 471
498 470
498 469
498 468
498 467
498 466
498 465
498 464
498 463
498 462
49...

result:

ok n = 499, k = 497: nice job dude

Test #25:

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

input:

499 498

output:

YES
62250
499 498
499 497
499 496
499 495
499 494
499 493
499 492
499 491
499 490
499 489
499 488
499 487
499 486
499 485
499 484
499 483
499 482
499 481
499 480
499 479
499 478
499 477
499 476
499 475
499 474
499 473
499 472
499 471
499 470
499 469
499 468
499 467
499 466
499 465
499 464
499 463
49...

result:

ok n = 499, k = 498: nice job dude

Test #26:

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

input:

499 499

output:

NO

result:

ok n = 499, k = 499: nice job dude

Test #27:

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

input:

500 1

output:

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

result:

ok n = 500, k = 1: nice job dude

Test #28:

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

input:

500 2

output:

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

result:

ok n = 500, k = 2: nice job dude

Test #29:

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

input:

500 3

output:

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

result:

ok n = 500, k = 3: nice job dude

Test #30:

score: 0
Accepted
time: 7ms
memory: 3976kb

input:

500 498

output:

YES
62251
499 498
499 497
499 496
499 495
499 494
499 493
499 492
499 491
499 490
499 489
499 488
499 487
499 486
499 485
499 484
499 483
499 482
499 481
499 480
499 479
499 478
499 477
499 476
499 475
499 474
499 473
499 472
499 471
499 470
499 469
499 468
499 467
499 466
499 465
499 464
499 463
49...

result:

ok n = 500, k = 498: nice job dude

Test #31:

score: 0
Accepted
time: 7ms
memory: 4008kb

input:

500 499

output:

YES
62500
500 499
500 498
500 497
500 496
500 495
500 494
500 493
500 492
500 491
500 490
500 489
500 488
500 487
500 486
500 485
500 484
500 483
500 482
500 481
500 480
500 479
500 478
500 477
500 476
500 475
500 474
500 473
500 472
500 471
500 470
500 469
500 468
500 467
500 466
500 465
500 464
50...

result:

ok n = 500, k = 499: nice job dude

Test #32:

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

input:

500 500

output:

NO

result:

ok n = 500, k = 500: nice job dude

Test #33:

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

input:

1 1

output:

YES
0

result:

ok n = 1, k = 1: nice job dude

Test #34:

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

input:

2 1

output:

YES
1
1 2

result:

ok n = 2, k = 1: nice job dude

Test #35:

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

input:

2 2

output:

NO

result:

ok n = 2, k = 2: nice job dude

Test #36:

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

input:

3 1

output:

YES
3
1 2
2 3
3 1

result:

ok n = 3, k = 1: nice job dude

Test #37:

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

input:

3 2

output:

YES
2
3 2
3 1

result:

ok n = 3, k = 2: nice job dude

Test #38:

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

input:

3 3

output:

NO

result:

ok n = 3, k = 3: nice job dude

Test #39:

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

input:

4 1

output:

YES
4
1 2
2 3
3 4
4 1

result:

ok n = 4, k = 1: nice job dude

Test #40:

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

input:

4 2

output:

YES
3
3 2
3 1
1 4

result:

ok n = 4, k = 2: nice job dude

Test #41:

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

input:

4 3

output:

YES
4
4 3
4 2
4 1
3 2

result:

ok n = 4, k = 3: nice job dude

Test #42:

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

input:

4 4

output:

NO

result:

ok n = 4, k = 4: nice job dude

Test #43:

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

input:

5 1

output:

YES
5
1 2
2 3
3 4
4 5
5 1

result:

ok n = 5, k = 1: nice job dude

Test #44:

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

input:

5 2

output:

YES
4
3 2
3 1
1 4
4 5

result:

ok n = 5, k = 2: nice job dude

Test #45:

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

input:

5 3

output:

YES
5
4 3
4 2
4 1
3 2
1 5

result:

ok n = 5, k = 3: nice job dude

Test #46:

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

input:

5 4

output:

YES
6
5 4
5 3
5 2
5 1
4 3
4 2

result:

ok n = 5, k = 4: nice job dude

Test #47:

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

input:

5 5

output:

NO

result:

ok n = 5, k = 5: nice job dude

Test #48:

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

input:

6 1

output:

YES
6
1 2
2 3
3 4
4 5
5 6
6 1

result:

ok n = 6, k = 1: nice job dude

Test #49:

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

input:

6 2

output:

YES
5
3 2
3 1
1 4
4 5
5 6

result:

ok n = 6, k = 2: nice job dude

Test #50:

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

input:

6 3

output:

YES
6
4 3
4 2
4 1
3 2
1 5
5 6

result:

ok n = 6, k = 3: nice job dude

Test #51:

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

input:

6 4

output:

YES
7
5 4
5 3
5 2
5 1
4 3
4 2
1 6

result:

ok n = 6, k = 4: nice job dude

Test #52:

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

input:

6 5

output:

YES
9
6 5
6 4
6 3
6 2
6 1
5 4
5 3
5 2
4 3

result:

ok n = 6, k = 5: nice job dude

Test #53:

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

input:

6 6

output:

NO

result:

ok n = 6, k = 6: nice job dude

Test #54:

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

input:

103 85

output:

YES
1866
86 85
86 84
86 83
86 82
86 81
86 80
86 79
86 78
86 77
86 76
86 75
86 74
86 73
86 72
86 71
86 70
86 69
86 68
86 67
86 66
86 65
86 64
86 63
86 62
86 61
86 60
86 59
86 58
86 57
86 56
86 55
86 54
86 53
86 52
86 51
86 50
86 49
86 48
86 47
86 46
86 45
86 44
86 43
86 42
86 41
86 40
86 39
86 38
86 ...

result:

ok n = 103, k = 85: nice job dude

Test #55:

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

input:

373 203

output:

YES
10573
204 203
204 202
204 201
204 200
204 199
204 198
204 197
204 196
204 195
204 194
204 193
204 192
204 191
204 190
204 189
204 188
204 187
204 186
204 185
204 184
204 183
204 182
204 181
204 180
204 179
204 178
204 177
204 176
204 175
204 174
204 173
204 172
204 171
204 170
204 169
204 168
20...

result:

ok n = 373, k = 203: nice job dude

Test #56:

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

input:

443 143

output:

YES
5483
144 143
144 142
144 141
144 140
144 139
144 138
144 137
144 136
144 135
144 134
144 133
144 132
144 131
144 130
144 129
144 128
144 127
144 126
144 125
144 124
144 123
144 122
144 121
144 120
144 119
144 118
144 117
144 116
144 115
144 114
144 113
144 112
144 111
144 110
144 109
144 108
144...

result:

ok n = 443, k = 143: nice job dude

Test #57:

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

input:

124 30

output:

YES
333
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 29
30 28
30 27
30 26
30 25
30 24
30 23
30 22
30 21
30 20
30 19
30 18
30 17
30 16
30 15
30 14
30 13
30 12
30 11
30 10
3...

result:

ok n = 124, k = 30: nice job dude

Test #58:

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

input:

194 6

output:

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

result:

ok n = 194, k = 6: nice job dude

Test #59:

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

input:

464 369

output:

YES
34319
370 369
370 368
370 367
370 366
370 365
370 364
370 363
370 362
370 361
370 360
370 359
370 358
370 357
370 356
370 355
370 354
370 353
370 352
370 351
370 350
370 349
370 348
370 347
370 346
370 345
370 344
370 343
370 342
370 341
370 340
370 339
370 338
370 337
370 336
370 335
370 334
37...

result:

ok n = 464, k = 369: nice job dude

Test #60:

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

input:

45 42

output:

YES
464
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 41
42 40
42 39
42 38
42 37
42 36
42 35
42 34
4...

result:

ok n = 45, k = 42: nice job dude

Test #61:

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

input:

115 106

output:

YES
2870
107 106
107 105
107 104
107 103
107 102
107 101
107 100
107 99
107 98
107 97
107 96
107 95
107 94
107 93
107 92
107 91
107 90
107 89
107 88
107 87
107 86
107 85
107 84
107 83
107 82
107 81
107 80
107 79
107 78
107 77
107 76
107 75
107 74
107 73
107 72
107 71
107 70
107 69
107 68
107 67
107 ...

result:

ok n = 115, k = 106: nice job dude

Test #62:

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

input:

285 220

output:

YES
12274
221 220
221 219
221 218
221 217
221 216
221 215
221 214
221 213
221 212
221 211
221 210
221 209
221 208
221 207
221 206
221 205
221 204
221 203
221 202
221 201
221 200
221 199
221 198
221 197
221 196
221 195
221 194
221 193
221 192
221 191
221 190
221 189
221 188
221 187
221 186
221 185
22...

result:

ok n = 285, k = 220: nice job dude

Test #63:

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

input:

143 106

output:

YES
2898
107 106
107 105
107 104
107 103
107 102
107 101
107 100
107 99
107 98
107 97
107 96
107 95
107 94
107 93
107 92
107 91
107 90
107 89
107 88
107 87
107 86
107 85
107 84
107 83
107 82
107 81
107 80
107 79
107 78
107 77
107 76
107 75
107 74
107 73
107 72
107 71
107 70
107 69
107 68
107 67
107 ...

result:

ok n = 143, k = 106: nice job dude