QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#134146#3269. 末日魔法少女计划zhouhuanyi79 1359ms190200kbC++233.6kb2023-08-03 09:37:022023-08-03 09:37:05

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-03 09:37:05]
  • 评测
  • 测评结果:79
  • 用时:1359ms
  • 内存:190200kb
  • [2023-08-03 09:37:02]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#define N 2001
#define M 15
#define K 100000
#define W 992
#define inf 1e8
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
struct reads
{
	int x,y;
};
reads tong[K+1];
int n,k,length,dp[M+1][W+1][N+1],ps[M+1][W+1][N+1],ps2[M+1][W+1][N+1],pst[M+1][W+1][N+1],F[N+1],F2[N+1],maxn[M+1]={0,0,0,31,320,276,992,992,991,990,989,988,987,986,985,984},smaxn[M+1]={0,0,2046,8679,13482,13482,13482,13482,13482,13482,13482,13482,13832,14670,15616,16286};
void adder(int x,int y)
{
	tong[++length]=(reads){x,y};
	return;
}
void calc()
{
	int res=0;
	for (int i=1;i<=n;++i) F[i]=i-1,F2[i]=(i-1)<<1;
	for (int i=0;i<=k;++i)
		for (int j=0;j<=min(W,n);++j)
			for (int t=0;t<=n;++t)
				dp[i][j][t]=inf;
	dp[0][0][0]=dp[0][0][1]=dp[1][0][0]=0;
	for (int i=1;i<=n;++i) dp[1][0][i]=((i*(i-1))>>1)-(i-1);
	for (int i=2;i<=k;++i)
	{
		for (int j=0;j<=n;++j)
		{
			if (j<=i+1) dp[i][0][j]=0;
			for (int s=1;s<=min(maxn[i],j-1);++s)
			{
				if (s==1)
				{
					for (int t=max(j-1-smaxn[i]/(s+1),0);t<=j-1;++t)
						if (dp[i][0][t]+dp[i][0][j-1-t]+F[t]+F2[j-1-t]+(t!=j-1)<dp[i][s][j])
							dp[i][s][j]=dp[i][0][t]+dp[i][0][j-1-t]+F[t]+F2[j-1-t]+(t!=j-1),ps[i][s][j]=t;
					res=max(res,(j-1-ps[i][s][j])*(s+1));
				}
				else
				{
					for (int t=max(j-1-smaxn[i]/(s+1),0);t<=j-1;++t)
						if (dp[i][s-1][t]+dp[i][0][j-1-t]+F2[j-1-t]+(t!=j-1)<dp[i][s][j])
							dp[i][s][j]=dp[i][s-1][t]+dp[i][0][j-1-t]+F2[j-1-t]+(t!=j-1),ps[i][s][j]=t;
					res=max(res,(j-1-ps[i][s][j])*(s+1));
				}
				if (j!=i-1)
				{
					for (int t=max(j-1-smaxn[i]/(s+2),0);t<=j-1;++t)
						if (dp[i][s][t]+dp[i][0][j-1-t]+F[j-1-t]+dp[i-2][0][s+1]<dp[i][0][j])
							dp[i][0][j]=dp[i][s][t]+dp[i][0][j-1-t]+F[j-1-t]+dp[i-2][0][s+1],ps[i][0][j]=pst[i][s][j]=t,ps2[i][0][j]=s;
				}
			}
			for (int t=0;t<=j-1;++t)
				if (dp[i][0][t]+dp[i][0][j-1-t]+F[t]+F[j-1-t]<dp[i][0][j])
					dp[i][0][j]=dp[i][0][t]+dp[i][0][j-1-t]+F[t]+F[j-1-t],ps[i][0][j]=t,ps2[i][0][j]=0;
			res=max(res,(j-1-ps[i][0][j])*(ps2[i][0][j]+2));
		}
	}
	return;
}
void solve(vector<int>p,int d)
{
	if (p.size()<=d+1) return;
	if (d==1)
	{
		for (int i=0;i<p.size();++i)
			for (int j=i+2;j<p.size();++j)
				adder(p[i],p[j]);
	}
	else
	{
		int r=ps2[d][0][p.size()]+1,pst;
		vector<int>v(r+1);
		vector<int>st;
		pst=ps[d][0][p.size()],v[r]=pst+1;
		for (int i=r-1;i>=1;--i) v[i]=ps[d][i][pst]+1,pst=ps[d][i][pst];
		for (int i=1;i<=r-1;++i)
			if (v[i+1]-v[i]!=1)
				adder(p[v[i]-1],p[v[i+1]-1]);
		for (int i=1;i<=r;++i) st.push_back(p[v[i]-1]);
		solve(st,d-2);
		if (1<=v[1]-1)
		{
			st.clear();
			for (int i=1;i<=v[1]-1;++i)
			{
				if (i!=v[1]-1) adder(p[i-1],p[v[1]-1]);
				st.push_back(p[i-1]);
			}
			solve(st,d);
		}
		for (int i=1;i<=r-1;++i)
			if (v[i]+1<=v[i+1]-1)
			{
				st.clear();
				for (int j=v[i]+1;j<=v[i+1]-1;++j)
				{
					if (j!=v[i]+1) adder(p[v[i]-1],p[j-1]);
					if (j!=v[i+1]-1) adder(p[j-1],p[v[i+1]-1]);
					st.push_back(p[j-1]);
				}
				solve(st,d);
			}
		if (v[r]+1<=p.size())
		{
			st.clear();
			for (int i=v[r]+1;i<=p.size();++i)
			{
				if (i!=v[r]+1) adder(p[v[r]-1],p[i-1]);
				st.push_back(p[i-1]);
			}
			solve(st,d);
		}
	}
	return;
}
int main()
{
	vector<int>p;
	n=read()+1,k=read(),calc();
	for (int i=1;i<=n;++i) p.push_back(i);
	solve(p,k),printf("%d\n",length);
	for (int i=1;i<=length;++i) printf("%d %d\n",tong[i].x-1,tong[i].y-1);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 22
Accepted

Test #1:

score: 22
Accepted
time: 7ms
memory: 34544kb

input:

2000 2

output:

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

result:

ok 

Test #2:

score: 22
Accepted
time: 0ms
memory: 34544kb

input:

1999 2

output:

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

result:

ok 

Test #3:

score: 22
Accepted
time: 4ms
memory: 32492kb

input:

1992 2

output:

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

result:

ok 

Test #4:

score: 22
Accepted
time: 2ms
memory: 32604kb

input:

1973 2

output:

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

result:

ok 

Test #5:

score: 22
Accepted
time: 3ms
memory: 34404kb

input:

1936 2

output:

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

result:

ok 

Subtask #2:

score: 14
Accepted

Test #6:

score: 14
Accepted
time: 64ms
memory: 46868kb

input:

1936 3

output:

7339
247 295
295 343
343 391
391 439
439 487
487 535
535 583
583 631
631 679
679 727
727 775
775 823
823 871
871 919
919 967
967 1015
1015 1063
1063 1111
1111 1159
1159 1207
1207 1255
1255 1303
1303 1351
1351 1399
1399 1447
1447 1495
1495 1543
1543 1591
1591 1639
1639 1687
247 343
247 391
247 439
24...

result:

ok 

Test #7:

score: 14
Accepted
time: 67ms
memory: 48804kb

input:

2000 3

output:

7605
249 297
297 345
345 393
393 441
441 489
489 537
537 585
585 633
633 681
681 729
729 777
777 825
825 873
873 921
921 969
969 1017
1017 1065
1065 1113
1113 1161
1161 1209
1209 1257
1257 1305
1305 1353
1353 1401
1401 1449
1449 1497
1497 1545
1545 1593
1593 1641
1641 1689
1689 1737
249 345
249 393
...

result:

ok 

Test #8:

score: 14
Accepted
time: 66ms
memory: 48788kb

input:

1999 3

output:

7601
248 296
296 344
344 392
392 440
440 488
488 536
536 584
584 632
632 680
680 728
728 776
776 824
824 872
872 920
920 968
968 1016
1016 1064
1064 1112
1112 1160
1160 1208
1208 1256
1256 1304
1304 1352
1352 1400
1400 1448
1448 1496
1496 1544
1544 1592
1592 1640
1640 1688
1688 1736
248 344
248 392
...

result:

ok 

Test #9:

score: 14
Accepted
time: 65ms
memory: 48776kb

input:

1992 3

output:

7572
235 283
283 331
331 379
379 427
427 475
475 523
523 571
571 619
619 667
667 715
715 763
763 811
811 859
859 907
907 955
955 1003
1003 1051
1051 1099
1099 1147
1147 1195
1195 1243
1243 1291
1291 1339
1339 1387
1387 1435
1435 1483
1483 1531
1531 1579
1579 1627
1627 1680
1680 1733
235 331
235 379
...

result:

ok 

Test #10:

score: 14
Accepted
time: 69ms
memory: 50840kb

input:

1973 3

output:

7493
231 279
279 327
327 375
375 423
423 471
471 519
519 567
567 615
615 663
663 711
711 759
759 807
807 855
855 903
903 951
951 999
999 1047
1047 1095
1095 1143
1143 1191
1191 1239
1239 1287
1287 1335
1335 1383
1383 1431
1431 1479
1479 1527
1527 1575
1575 1623
1623 1671
1671 1719
231 327
231 375
23...

result:

ok 

Subtask #3:

score: 11
Accepted

Test #11:

score: 11
Accepted
time: 243ms
memory: 67204kb

input:

2000 4

output:

4792
39 45
45 51
51 57
57 63
63 69
69 75
75 81
81 87
87 93
93 99
99 105
105 111
111 117
117 123
123 129
129 135
135 141
141 147
147 153
153 159
159 165
165 171
171 177
177 183
183 189
189 195
195 201
201 207
207 213
213 219
219 225
225 231
231 237
237 243
243 249
249 255
255 261
261 267
267 273
273 ...

result:

ok 

Test #12:

score: 11
Accepted
time: 237ms
memory: 67216kb

input:

1999 4

output:

4789
39 45
45 51
51 57
57 63
63 69
69 75
75 81
81 87
87 93
93 99
99 105
105 111
111 117
117 123
123 129
129 135
135 141
141 147
147 153
153 159
159 165
165 171
171 177
177 183
183 189
189 195
195 201
201 207
207 213
213 219
219 225
225 231
231 237
237 243
243 249
249 255
255 261
261 267
267 273
273 ...

result:

ok 

Test #13:

score: 11
Accepted
time: 253ms
memory: 69220kb

input:

1991 4

output:

4768
37 43
43 49
49 55
55 61
61 67
67 73
73 79
79 85
85 91
91 97
97 103
103 109
109 115
115 121
121 127
127 133
133 139
139 145
145 151
151 157
157 163
163 169
169 175
175 181
181 187
187 193
193 199
199 205
205 211
211 217
217 223
223 229
229 235
235 241
241 247
247 253
253 259
259 265
265 271
271 ...

result:

ok 

Test #14:

score: 11
Accepted
time: 242ms
memory: 65240kb

input:

1971 4

output:

4715
39 45
45 51
51 57
57 63
63 69
69 75
75 81
81 87
87 93
93 99
99 105
105 111
111 117
117 123
123 129
129 135
135 141
141 147
147 153
153 159
159 165
165 171
171 177
177 183
183 189
189 195
195 201
201 207
207 213
213 219
219 225
225 231
231 237
237 243
243 249
249 255
255 261
261 267
267 273
273 ...

result:

ok 

Test #15:

score: 11
Accepted
time: 239ms
memory: 67172kb

input:

1938 4

output:

4626
39 45
45 51
51 57
57 63
63 69
69 75
75 81
81 87
87 93
93 99
99 105
105 111
111 117
117 123
123 129
129 135
135 141
141 147
147 153
153 159
159 165
165 171
171 177
177 183
183 189
189 195
195 201
201 207
207 213
213 219
219 225
225 231
231 237
237 243
243 249
249 255
255 261
261 267
267 273
273 ...

result:

ok 

Subtask #4:

score: 9
Accepted

Test #16:

score: 9
Accepted
time: 421ms
memory: 85640kb

input:

2000 5

output:

3922
31 38
38 45
45 52
52 59
59 66
66 73
73 80
80 87
87 94
94 101
101 108
108 115
115 122
122 129
129 136
136 143
143 150
150 157
157 164
164 171
171 178
178 185
185 192
192 199
199 206
206 213
213 220
220 227
227 234
234 241
241 248
248 255
255 262
262 269
269 276
276 283
283 290
290 297
297 304
30...

result:

ok 

Test #17:

score: 9
Accepted
time: 418ms
memory: 85624kb

input:

1999 5

output:

3920
37 44
44 51
51 58
58 65
65 72
72 79
79 86
86 93
93 100
100 107
107 114
114 121
121 128
128 135
135 142
142 149
149 156
156 163
163 170
170 177
177 184
184 191
191 198
198 205
205 212
212 219
219 226
226 233
233 240
240 247
247 254
254 261
261 268
268 275
275 282
282 289
289 296
296 303
303 310
...

result:

ok 

Test #18:

score: 9
Accepted
time: 419ms
memory: 83548kb

input:

1992 5

output:

3905
37 44
44 51
51 58
58 65
65 72
72 79
79 86
86 93
93 100
100 107
107 114
114 121
121 128
128 135
135 142
142 149
149 156
156 163
163 170
170 177
177 184
184 191
191 198
198 205
205 212
212 219
219 226
226 233
233 240
240 247
247 254
254 261
261 268
268 275
275 282
282 289
289 296
296 303
303 310
...

result:

ok 

Test #19:

score: 9
Accepted
time: 401ms
memory: 83544kb

input:

1973 5

output:

3866
32 39
39 46
46 53
53 60
60 67
67 74
74 81
81 88
88 95
95 102
102 109
109 116
116 123
123 130
130 137
137 144
144 151
151 158
158 165
165 172
172 179
179 186
186 193
193 200
200 207
207 214
214 221
221 228
228 235
235 242
242 249
249 256
256 263
263 270
270 277
277 284
284 291
291 298
298 305
30...

result:

ok 

Test #20:

score: 9
Accepted
time: 404ms
memory: 85592kb

input:

1936 5

output:

3791
37 44
44 51
51 58
58 65
65 72
72 79
79 86
86 93
93 100
100 107
107 114
114 121
121 128
128 135
135 142
142 149
149 156
156 163
163 170
170 177
177 184
184 191
191 198
198 205
205 212
212 219
219 226
226 233
233 240
240 247
247 254
254 261
261 268
268 275
275 282
282 289
289 296
296 303
303 310
...

result:

ok 

Subtask #5:

score: 7
Accepted

Test #21:

score: 7
Accepted
time: 645ms
memory: 116416kb

input:

2000 6

output:

3213
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105...

result:

ok 

Test #22:

score: 7
Accepted
time: 644ms
memory: 114292kb

input:

1997 6

output:

3208
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105...

result:

ok 

Test #23:

score: 7
Accepted
time: 628ms
memory: 116412kb

input:

1989 6

output:

3194
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105...

result:

ok 

Test #24:

score: 7
Accepted
time: 646ms
memory: 114296kb

input:

1972 6

output:

3164
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105...

result:

ok 

Test #25:

score: 7
Accepted
time: 622ms
memory: 116348kb

input:

1933 6

output:

3096
7 9
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105...

result:

ok 

Subtask #6:

score: 6
Accepted

Test #26:

score: 6
Accepted
time: 867ms
memory: 140920kb

input:

1999 7

output:

2901
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Test #27:

score: 6
Accepted
time: 871ms
memory: 140920kb

input:

1997 7

output:

2898
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Test #28:

score: 6
Accepted
time: 863ms
memory: 141008kb

input:

1987 7

output:

2883
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Test #29:

score: 6
Accepted
time: 870ms
memory: 138936kb

input:

1978 7

output:

2869
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Test #30:

score: 6
Accepted
time: 825ms
memory: 142968kb

input:

1931 7

output:

2799
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Subtask #7:

score: 5
Accepted

Test #31:

score: 5
Accepted
time: 1108ms
memory: 167556kb

input:

1995 8

output:

2501
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105
105...

result:

ok 

Test #32:

score: 5
Accepted
time: 1111ms
memory: 165476kb

input:

1999 8

output:

2506
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105
105...

result:

ok 

Test #33:

score: 5
Accepted
time: 1109ms
memory: 167536kb

input:

1987 8

output:

2490
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105
105...

result:

ok 

Test #34:

score: 5
Accepted
time: 1088ms
memory: 167492kb

input:

1981 8

output:

2481
8 10
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104...

result:

ok 

Test #35:

score: 5
Accepted
time: 1057ms
memory: 165560kb

input:

1923 8

output:

2405
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105
105...

result:

ok 

Subtask #8:

score: 5
Accepted

Test #36:

score: 5
Accepted
time: 1341ms
memory: 190052kb

input:

1997 9

output:

2392
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104 106
...

result:

ok 

Test #37:

score: 5
Accepted
time: 1359ms
memory: 190152kb

input:

1998 9

output:

2393
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104 106
...

result:

ok 

Test #38:

score: 5
Accepted
time: 1346ms
memory: 190200kb

input:

1990 9

output:

2383
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104 106
...

result:

ok 

Test #39:

score: 5
Accepted
time: 1316ms
memory: 190140kb

input:

1975 9

output:

2364
9 11
11 13
13 15
15 17
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
45 47
47 49
49 51
51 53
53 55
55 57
57 59
59 61
61 63
63 65
65 67
67 69
69 71
71 73
73 75
75 77
77 79
79 81
81 83
83 85
85 87
87 89
89 91
91 93
93 95
95 97
97 99
99 101
101 103
103 105
105...

result:

ok 

Test #40:

score: 5
Accepted
time: 1269ms
memory: 190056kb

input:

1934 9

output:

2313
10 12
12 14
14 16
16 18
18 20
20 22
22 24
24 26
26 28
28 30
30 32
32 34
34 36
36 38
38 40
40 42
42 44
44 46
46 48
48 50
50 52
52 54
54 56
56 58
58 60
60 62
62 64
64 66
66 68
68 70
70 72
72 74
74 76
76 78
78 80
80 82
82 84
84 86
86 88
88 90
90 92
92 94
94 96
96 98
98 100
100 102
102 104
104 106
...

result:

ok 

Subtask #9:

score: 0
Time Limit Exceeded

Test #41:

score: 0
Time Limit Exceeded

input:

1995 10

output:


result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #46:

score: 0
Time Limit Exceeded

input:

1993 11

output:


result:


Subtask #11:

score: 0
Time Limit Exceeded

Test #51:

score: 0
Time Limit Exceeded

input:

1999 12

output:


result:


Subtask #12:

score: 0
Time Limit Exceeded

Test #56:

score: 0
Time Limit Exceeded

input:

1981 13

output:


result:


Subtask #13:

score: 0
Time Limit Exceeded

Test #61:

score: 0
Time Limit Exceeded

input:

1979 14

output:


result:


Subtask #14:

score: 0
Time Limit Exceeded

Test #66:

score: 0
Time Limit Exceeded

input:

2000 15

output:


result: