QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#134141#3269. 末日魔法少女计划zhouhuanyi86.069317 1455ms245432kbC++233.4kb2023-08-03 09:13:582023-08-03 09:13:59

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:13:59]
  • 评测
  • 测评结果:86.069317
  • 用时:1455ms
  • 内存:245432kb
  • [2023-08-03 09:13:58]
  • 提交

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,0,3978,7360,9583,9583,9583,9583,9900,10879,11856,12831,13804,14774,15744};
void adder(int x,int y)
{
	tong[++length]=(reads){x,y};
	return;
}
void calc()
{
	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,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;
				}
				else
				{
					for (int t=max(j-1-smaxn[i]/s,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;
				}
				if (j!=i-1)
				{
					for (int t=max(j-1-smaxn[i]/s,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;
		}
	}
	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: 5ms
memory: 36492kb

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

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: 5ms
memory: 34444kb

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: 11ms
memory: 34420kb

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: 4ms
memory: 34536kb

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: 13.5188
Acceptable Answer

Test #6:

score: 14
Accepted
time: 48ms
memory: 48856kb

input:

1936 3

output:

7358
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 1117
1117 1170
1170 1223
1223 1276
1276 1329
1329 1382
1382 1435
1435 1488
1488 1541
1541 1594
1594 1647
1647 1700
1700 1753
1753 1808
248 344
248 392
...

result:

ok 

Test #7:

score: 13.5188
Acceptable Answer
time: 41ms
memory: 46744kb

input:

2000 3

output:

7626
249 297
297 345
345 393
393 441
441 494
494 547
547 600
600 653
653 706
706 759
759 812
812 865
865 918
918 971
971 1024
1024 1077
1077 1130
1130 1183
1183 1236
1236 1289
1289 1342
1342 1395
1395 1448
1448 1501
1501 1554
1554 1607
1607 1660
1660 1713
1713 1766
1766 1819
1819 1872
249 345
249 39...

result:

points 0.9656260630

Test #8:

score: 13.5238
Acceptable Answer
time: 40ms
memory: 48792kb

input:

1999 3

output:

7622
248 296
296 344
344 392
392 440
440 493
493 546
546 599
599 652
652 705
705 758
758 811
811 864
864 917
917 970
970 1023
1023 1076
1076 1129
1129 1182
1182 1235
1235 1288
1288 1341
1341 1394
1394 1447
1447 1500
1500 1553
1553 1606
1606 1659
1659 1712
1712 1765
1765 1818
1818 1871
248 344
248 39...

result:

points 0.9659852250

Test #9:

score: 13.5912
Acceptable Answer
time: 44ms
memory: 48800kb

input:

1992 3

output:

7593
249 297
297 345
345 393
393 441
441 489
489 537
537 590
590 643
643 696
696 749
749 802
802 855
855 908
908 961
961 1014
1014 1067
1067 1120
1120 1173
1173 1226
1226 1279
1279 1332
1332 1385
1385 1438
1438 1491
1491 1544
1544 1597
1597 1650
1650 1703
1703 1756
1756 1809
1809 1864
249 345
249 39...

result:

points 0.97080131060

Test #10:

score: 14
Accepted
time: 44ms
memory: 48916kb

input:

1973 3

output:

7513
247 295
295 343
343 391
391 439
439 487
487 535
535 583
583 631
631 679
679 732
732 785
785 838
838 891
891 944
944 997
997 1050
1050 1103
1103 1156
1156 1209
1209 1262
1262 1315
1315 1368
1368 1421
1421 1474
1474 1527
1527 1580
1580 1633
1633 1686
1686 1739
1739 1792
1792 1845
247 343
247 391
...

result:

ok 

Subtask #3:

score: 10.5506
Acceptable Answer

Test #11:

score: 10.5506
Acceptable Answer
time: 162ms
memory: 67200kb

input:

2000 4

output:

4800
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:

points 0.95914110770

Test #12:

score: 10.5677
Acceptable Answer
time: 163ms
memory: 67320kb

input:

1999 4

output:

4797
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:

points 0.96070397270

Test #13:

score: 10.745
Acceptable Answer
time: 158ms
memory: 67292kb

input:

1991 4

output:

4773
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:

points 0.97681644810

Test #14:

score: 11
Accepted
time: 152ms
memory: 65224kb

input:

1971 4

output:

4717
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: 157ms
memory: 67160kb

input:

1938 4

output:

4629
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 

Subtask #4:

score: 9
Accepted

Test #16:

score: 9
Accepted
time: 289ms
memory: 87664kb

input:

2000 5

output:

3922
34 41
41 48
48 55
55 62
62 69
69 76
76 83
83 90
90 97
97 104
104 111
111 118
118 125
125 132
132 139
139 146
146 153
153 160
160 167
167 174
174 181
181 188
188 195
195 202
202 209
209 216
216 223
223 230
230 237
237 244
244 251
251 258
258 265
265 272
272 279
279 286
286 293
293 300
300 307
30...

result:

ok 

Test #17:

score: 9
Accepted
time: 287ms
memory: 85596kb

input:

1999 5

output:

3920
33 40
40 47
47 54
54 61
61 68
68 75
75 82
82 89
89 96
96 103
103 110
110 117
117 124
124 131
131 138
138 145
145 152
152 159
159 166
166 173
173 180
180 187
187 194
194 201
201 208
208 215
215 222
222 229
229 236
236 243
243 250
250 257
257 264
264 271
271 278
278 285
285 292
292 299
299 306
30...

result:

ok 

Test #18:

score: 9
Accepted
time: 299ms
memory: 87668kb

input:

1992 5

output:

3906
40 47
47 54
54 61
61 68
68 75
75 82
82 89
89 96
96 103
103 110
110 117
117 124
124 131
131 138
138 145
145 152
152 159
159 166
166 173
173 180
180 187
187 194
194 201
201 208
208 215
215 222
222 229
229 236
236 243
243 250
250 257
257 264
264 271
271 278
278 285
285 292
292 299
299 306
306 313
...

result:

ok 

Test #19:

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

input:

1973 5

output:

3866
34 41
41 48
48 55
55 62
62 69
69 76
76 83
83 90
90 97
97 104
104 111
111 118
118 125
125 132
132 139
139 146
146 153
153 160
160 167
167 174
174 181
181 188
188 195
195 202
202 209
209 216
216 223
223 230
230 237
237 244
244 251
251 258
258 265
265 272
272 279
279 286
286 293
293 300
300 307
30...

result:

ok 

Test #20:

score: 9
Accepted
time: 283ms
memory: 83660kb

input:

1936 5

output:

3791
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 

Subtask #5:

score: 7
Accepted

Test #21:

score: 7
Accepted
time: 480ms
memory: 116340kb

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: 474ms
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: 469ms
memory: 114284kb

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: 465ms
memory: 118524kb

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: 449ms
memory: 116412kb

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: 645ms
memory: 143084kb

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: 644ms
memory: 138864kb

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: 650ms
memory: 138888kb

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: 646ms
memory: 140956kb

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: 619ms
memory: 138888kb

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: 828ms
memory: 167608kb

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: 841ms
memory: 165484kb

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: 825ms
memory: 167588kb

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: 827ms
memory: 163528kb

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: 815ms
memory: 165552kb

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: 1032ms
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: 1008ms
memory: 190136kb

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: 1012ms
memory: 190116kb

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: 996ms
memory: 192128kb

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: 999ms
memory: 194188kb

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: 4
Accepted

Test #41:

score: 4
Accepted
time: 1213ms
memory: 216688kb

input:

1995 10

output:

2193
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 107
...

result:

ok 

Test #42:

score: 4
Accepted
time: 1230ms
memory: 216704kb

input:

1996 10

output:

2194
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 107
...

result:

ok 

Test #43:

score: 4
Accepted
time: 1218ms
memory: 214756kb

input:

1979 10

output:

2175
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 107
...

result:

ok 

Test #44:

score: 4
Accepted
time: 1199ms
memory: 216692kb

input:

1972 10

output:

2166
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 107
...

result:

ok 

Test #45:

score: 4
Accepted
time: 1165ms
memory: 214760kb

input:

1945 10

output:

2135
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 #10:

score: 4
Accepted

Test #46:

score: 4
Accepted
time: 1455ms
memory: 239212kb

input:

1993 11

output:

2133
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
106 10...

result:

ok 

Test #47:

score: 4
Accepted
time: 1410ms
memory: 245432kb

input:

1994 11

output:

2134
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
106 10...

result:

ok 

Test #48:

score: 4
Accepted
time: 1416ms
memory: 241272kb

input:

2000 11

output:

2140
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
106 10...

result:

ok 

Test #49:

score: 4
Accepted
time: 1378ms
memory: 241312kb

input:

1972 11

output:

2109
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
106 10...

result:

ok 

Test #50:

score: 4
Accepted
time: 1357ms
memory: 243388kb

input:

1944 11

output:

2077
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
106 10...

result:

ok 

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: