QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21638#2848. 城市地铁规划LFCode#AC ✓40ms111936kbC++142.6kb2022-03-07 17:28:522022-05-08 03:45:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 03:45:53]
  • 评测
  • 测评结果:AC
  • 用时:40ms
  • 内存:111936kb
  • [2022-03-07 17:28:52]
  • 提交

answer

#include<bits/stdc++.h>
#include<cstdio>
#include<cctype>
#define ll long long
#define PI pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define ui unsigned int
#define pb push_back
#define llu long long unsigned
using namespace std;
const int MB=1<<20;
struct FastIO{
	char ib[MB+100],*p,*q;
	char ob[MB+100],*r,stk[128];
	int tp;
	FastIO(){p=q=ib,r=ob,tp=0;}
	~FastIO(){fwrite(ob,1,r-ob,stdout);}
	char read_char(){if(p==q){p=ib,q=ib+fread(ib,1,MB,stdin);if(p==q)return 0;}return *p++;}
	template<typename T>
	void read_int(T& x){char c=read_char(),l=0;for(x=0;!isdigit(c);c=read_char())l=c;for(;isdigit(c);c=read_char())x=x*10-'0'+c;if(l=='-')x=-x;}
	void write_char(char c){if(r-ob==MB)r=ob,fwrite(ob,1,MB,stdout);*r++=c;}
	template<typename T>
	void write_int(T x){if(x<0)write_char('-'),x=-x;do stk[++tp]=x%10+'0';while(x/=10);while(tp)write_char(stk[tp--]);}
}IO;
//IO.read_int(a);c=IO.read_char();IO.write_int(a);//IO.write_char(c);
const int N=3010,M=6010,mod=59393;
int T,n,k,a[N];
int f[N][N],ff[M];
PI bef[N][N];
int qwq[M];
int rd[N];
int main(){
//	scanf("%d",&T);
	T=1;
	while(T--){
		scanf("%d%d",&n,&k);
		ll lytqwq=0;
		for(int i=0;i<=k;i++){
			scanf("%d",&a[i]);
			lytqwq+=a[i];
		}
		
		for(int i=0;i<=2*n;i++){
			int res=1;
			for(int o=0;o<=k;o++){
				ff[i]=(ff[i]+res*1ll*a[o])%mod;
				res=res*1ll*i%mod;
			}
		}
		if(n==1){
			cout<<0<<" "<<ff[0];
			return 0;
		}
		else if(n==2){
			printf("%d %lld\n",1,ff[1]*2);
			printf("1 2\n");
			return 0;
		}
		ll res=ff[1]*1ll*n,rrr=ff[1];
		for(int i=1;i<=2*n-1;i++){
			ff[i]=ff[i+1]-rrr;
		}
		
		memset(f,-0x3f,sizeof(f));
		f[n-1][n-2]=0;
		for(int i=n-2;i>=1;i--){
			for(int v=n-2;v>=0;v--){
				bef[i][v]=mp(i+1,v);
				f[i][v]=f[i+1][v];
				if(v+i<=n-1){
					if(f[i][v+i]+ff[i]>f[i][v]){
						f[i][v]=f[i][v+i]+ff[i];
						bef[i][v]=mp(i,v+i);
					}
				}
			}
		}
		PI now=mp(1,0),endd=mp(n-1,n-2);
		printf("%d %lld\n",n-1,f[1][0]+res);
		while(now!=endd){
			qwq[bef[now.fi][now.se].se-now.se+1]++;
			now=bef[now.fi][now.se];
		}
		int ss=0;
		for(int i=2;i<=2*(n-1);i++){
			ss+=qwq[i];
		}
		int noww=0,fal=ss;
		for(int i=2;i<=2*(n-1);i++){
			while(qwq[i]--){
				noww++;
				int t=i-1-(noww!=1);
				while(t--){
					ss++;
					printf("%d %d\n",noww,ss);
				}
				if(noww!=fal)
				printf("%d %d\n",noww,noww+1);
				else 
				printf("%d %d\n",noww,ss+1);
			}
		}
//		for(int i=1;i<=n;i++){
//			for(int v=1;v<=2*n;v++){
//				for(int k=1;k<=v;k++){
//					f[i][v]=max(f[i][v],f[i-1][v-k]+ff[k]);
//				}
//			}
//		}
//		printf("%d\n",f[n][2*(n-1)]);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

63 7
4 50 14 48 33 13 44 24

output:

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

result:

ok 

Test #2:

score: 0
Accepted
time: 8ms
memory: 41820kb

input:

208 7
23 28 14 16 46 28 26 28

output:

207 3317121
1 104
1 105
1 2
2 106
2 3
3 107
3 4
4 108
4 5
5 109
5 6
6 110
6 7
7 111
7 8
8 112
8 9
9 113
9 10
10 114
10 11
11 115
11 12
12 116
12 13
13 117
13 14
14 118
14 15
15 119
15 16
16 120
16 17
17 121
17 18
18 122
18 19
19 123
19 20
20 124
20 21
21 125
21 22
22 126
22 23
23 127
23 24
24 128
24...

result:

ok 

Test #3:

score: 0
Accepted
time: 36ms
memory: 109500kb

input:

2928 3
27 20 7 29

output:

2927 13889888
1 267
1 268
1 269
1 270
1 271
1 272
1 273
1 274
1 275
1 276
1 277
1 2
2 278
2 279
2 280
2 281
2 282
2 283
2 284
2 285
2 286
2 287
2 3
3 288
3 289
3 290
3 291
3 292
3 293
3 294
3 295
3 296
3 297
3 4
4 298
4 299
4 300
4 301
4 302
4 303
4 304
4 305
4 306
4 307
4 5
5 308
5 309
5 310
5 311
...

result:

ok 

Test #4:

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

input:

320 3
46 42 15 15

output:

319 1260206
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 2
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 3
3 47
3 48
3 49
3 50
3 51
3 52
3 53
3 54
3 55
3 56
3 57
3 58
3 59
3 4
4 60
4 61
4 62
4 63
4 64
4 65
4 66
4 67
4 68
4 69
4 70
4 71
4 72
4 5
5 73
5 74
5 75
5 76
5 77
5 ...

result:

ok 

Test #5:

score: 0
Accepted
time: 4ms
memory: 43316kb

input:

380 5
41 27 8 3 31 0

output:

379 3140470
1 77
1 78
1 79
1 2
2 80
2 81
2 82
2 83
2 3
3 84
3 85
3 86
3 87
3 4
4 88
4 89
4 90
4 91
4 5
5 92
5 93
5 94
5 95
5 6
6 96
6 97
6 98
6 99
6 7
7 100
7 101
7 102
7 103
7 8
8 104
8 105
8 106
8 107
8 9
9 108
9 109
9 110
9 111
9 10
10 112
10 113
10 114
10 115
10 11
11 116
11 117
11 118
11 119
11...

result:

ok 

Test #6:

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

input:

365 5
35 20 24 29 3 25

output:

364 3508667
1 122
1 123
1 124
1 2
2 125
2 126
2 3
3 127
3 128
3 4
4 129
4 130
4 5
5 131
5 132
5 6
6 133
6 134
6 7
7 135
7 136
7 8
8 137
8 138
8 9
9 139
9 140
9 10
10 141
10 142
10 11
11 143
11 144
11 12
12 145
12 146
12 13
13 147
13 148
13 14
14 149
14 150
14 15
15 151
15 152
15 16
16 153
16 154
16 ...

result:

ok 

Test #7:

score: 0
Accepted
time: 4ms
memory: 42768kb

input:

318 6
4 44 46 6 37 14 49

output:

317 6799456
1 159
1 160
1 2
2 161
2 3
3 162
3 4
4 163
4 5
5 164
5 6
6 165
6 7
7 166
7 8
8 167
8 9
9 168
9 10
10 169
10 11
11 170
11 12
12 171
12 13
13 172
13 14
14 173
14 15
15 174
15 16
16 175
16 17
17 176
17 18
18 177
18 19
19 178
19 20
20 179
20 21
21 180
21 22
22 181
22 23
23 182
23 24
24 183
24...

result:

ok 

Test #8:

score: 0
Accepted
time: 8ms
memory: 43668kb

input:

416 6
30 23 4 16 45 32 19

output:

415 5383994
1 208
1 209
1 2
2 210
2 3
3 211
3 4
4 212
4 5
5 213
5 6
6 214
6 7
7 215
7 8
8 216
8 9
9 217
9 10
10 218
10 11
11 219
11 12
12 220
12 13
13 221
13 14
14 222
14 15
15 223
15 16
16 224
16 17
17 225
17 18
18 226
18 19
19 227
19 20
20 228
20 21
21 229
21 22
22 230
22 23
23 231
23 24
24 232
24...

result:

ok 

Test #9:

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

input:

572 5
15 27 5 18 3 46

output:

571 9396678
1 191
1 192
1 193
1 2
2 194
2 195
2 3
3 196
3 197
3 4
4 198
4 199
4 5
5 200
5 201
5 6
6 202
6 203
6 7
7 204
7 205
7 8
8 206
8 207
8 9
9 208
9 209
9 10
10 210
10 211
10 11
11 212
11 213
11 12
12 214
12 215
12 13
13 216
13 217
13 14
14 218
14 219
14 15
15 220
15 221
15 16
16 222
16 223
16 ...

result:

ok 

Test #10:

score: 0
Accepted
time: 4ms
memory: 44984kb

input:

531 8
20 13 35 27 41 43 36 25 5

output:

530 9024252
1 178
1 2
2 179
2 180
2 3
3 181
3 182
3 4
4 183
4 184
4 5
5 185
5 186
5 6
6 187
6 188
6 7
7 189
7 190
7 8
8 191
8 192
8 9
9 193
9 194
9 10
10 195
10 196
10 11
11 197
11 198
11 12
12 199
12 200
12 13
13 201
13 202
13 14
14 203
14 204
14 15
15 205
15 206
15 16
16 207
16 208
16 17
17 209
17...

result:

ok 

Test #11:

score: 0
Accepted
time: 4ms
memory: 44424kb

input:

487 10
29 29 40 45 5 16 40 47 47 2 14

output:

486 18026623
1 486
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 5...

result:

ok 

Test #12:

score: 0
Accepted
time: 4ms
memory: 47660kb

input:

584 7
10 27 29 8 32 43 26 3

output:

583 11437238
1 292
1 293
1 2
2 294
2 3
3 295
3 4
4 296
4 5
5 297
5 6
6 298
6 7
7 299
7 8
8 300
8 9
9 301
9 10
10 302
10 11
11 303
11 12
12 304
12 13
13 305
13 14
14 306
14 15
15 307
15 16
16 308
16 17
17 309
17 18
18 310
18 19
19 311
19 20
20 312
20 21
21 313
21 22
22 314
22 23
23 315
23 24
24 316
2...

result:

ok 

Test #13:

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

input:

59 4
48 16 9 42 21

output:

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

result:

ok 

Test #14:

score: 0
Accepted
time: 4ms
memory: 45328kb

input:

561 3
22 31 17 49

output:

560 3223790
1 64
1 2
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 72
2 3
3 73
3 74
3 75
3 76
3 77
3 78
3 79
3 80
3 4
4 81
4 82
4 83
4 84
4 85
4 86
4 87
4 88
4 5
5 89
5 90
5 91
5 92
5 93
5 94
5 95
5 96
5 6
6 97
6 98
6 99
6 100
6 101
6 102
6 103
6 104
6 7
7 105
7 106
7 107
7 108
7 109
7 110
7 111
7 112
7 8
8 ...

result:

ok 

Test #15:

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

input:

629 6
26 31 41 32 13 39 41

output:

628 13149156
1 315
1 2
2 316
2 3
3 317
3 4
4 318
4 5
5 319
5 6
6 320
6 7
7 321
7 8
8 322
8 9
9 323
9 10
10 324
10 11
11 325
11 12
12 326
12 13
13 327
13 14
14 328
14 15
15 329
15 16
16 330
16 17
17 331
17 18
18 332
18 19
19 333
19 20
20 334
20 21
21 335
21 22
22 336
22 23
23 337
23 24
24 338
24 25
2...

result:

ok 

Test #16:

score: 0
Accepted
time: 18ms
memory: 46056kb

input:

616 3
38 48 27 2

output:

615 1394108
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 2
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 3
3 64
3 65
3 66
3 67
3 68
3 69
3 70
3 71
3 72
3 73
3 74
3 75
3 76
3 77
3 78
3 79
3 80
3 81
...

result:

ok 

Test #17:

score: 0
Accepted
time: 14ms
memory: 47924kb

input:

744 2
49 45 50

output:

743 1425426
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 2
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 3
3 72
3 73
3 74
3 75
3 76
3 77
3 78
3 79
...

result:

ok 

Test #18:

score: 0
Accepted
time: 11ms
memory: 46248kb

input:

629 7
27 18 48 24 37 38 6 3

output:

628 9258317
1 159
1 2
2 160
2 3
3 161
3 162
3 163
3 4
4 164
4 165
4 166
4 5
5 167
5 168
5 169
5 6
6 170
6 171
6 172
6 7
7 173
7 174
7 175
7 8
8 176
8 177
8 178
8 9
9 179
9 180
9 181
9 10
10 182
10 183
10 184
10 11
11 185
11 186
11 187
11 12
12 188
12 189
12 190
12 13
13 191
13 192
13 193
13 14
14 19...

result:

ok 

Test #19:

score: 0
Accepted
time: 4ms
memory: 45944kb

input:

602 8
17 25 14 13 2 16 23 24 44

output:

601 9947756
1 601
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...

result:

ok 

Test #20:

score: 0
Accepted
time: 13ms
memory: 50536kb

input:

900 2
9 13 12

output:

899 787522
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 2
2 29
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
...

result:

ok 

Test #21:

score: 0
Accepted
time: 13ms
memory: 49492kb

input:

839 7
12 12 28 33 35 29 14 17

output:

838 24516016
1 420
1 2
2 421
2 3
3 422
3 4
4 423
4 5
5 424
5 6
6 425
6 7
7 426
7 8
8 427
8 9
9 428
9 10
10 429
10 11
11 430
11 12
12 431
12 13
13 432
13 14
14 433
14 15
15 434
15 16
16 435
16 17
17 436
17 18
18 437
18 19
19 438
19 20
20 439
20 21
21 440
21 22
22 441
22 23
23 442
23 24
24 443
24 25
2...

result:

ok 

Test #22:

score: 0
Accepted
time: 8ms
memory: 48288kb

input:

768 7
27 3 40 6 39 9 48 31

output:

767 18960055
1 384
1 385
1 2
2 386
2 3
3 387
3 4
4 388
4 5
5 389
5 6
6 390
6 7
7 391
7 8
8 392
8 9
9 393
9 10
10 394
10 11
11 395
11 12
12 396
12 13
13 397
13 14
14 398
14 15
15 399
15 16
16 400
16 17
17 401
17 18
18 402
18 19
19 403
19 20
20 404
20 21
21 405
21 22
22 406
22 23
23 407
23 24
24 408
2...

result:

ok 

Test #23:

score: 0
Accepted
time: 8ms
memory: 48448kb

input:

783 3
25 19 31 45

output:

782 4263811
1 88
1 89
1 90
1 91
1 92
1 93
1 94
1 2
2 95
2 96
2 97
2 98
2 99
2 100
2 101
2 102
2 3
3 103
3 104
3 105
3 106
3 107
3 108
3 109
3 110
3 4
4 111
4 112
4 113
4 114
4 115
4 116
4 117
4 118
4 5
5 119
5 120
5 121
5 122
5 123
5 124
5 125
5 126
5 6
6 127
6 128
6 129
6 130
6 131
6 132
6 133
6 13...

result:

ok 

Test #24:

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

input:

2 4
24 9 31 45 15

output:

1 248
1 2

result:

ok 

Test #25:

score: 0
Accepted
time: 9ms
memory: 48768kb

input:

792 5
28 40 21 32 44 11

output:

791 6695732
1 265
1 2
2 266
2 267
2 3
3 268
3 269
3 4
4 270
4 271
4 5
5 272
5 273
5 6
6 274
6 275
6 7
7 276
7 277
7 8
8 278
8 279
8 9
9 280
9 281
9 10
10 282
10 283
10 11
11 284
11 285
11 12
12 286
12 287
12 13
13 288
13 289
13 14
14 290
14 291
14 15
15 292
15 293
15 16
16 294
16 295
16 17
17 296
17...

result:

ok 

Test #26:

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

input:

939 5
35 7 31 40 25 28

output:

938 12031060
1 313
1 314
1 315
1 2
2 316
2 317
2 3
3 318
3 319
3 4
4 320
4 321
4 5
5 322
5 323
5 6
6 324
6 325
6 7
7 326
7 327
7 8
8 328
8 329
8 9
9 330
9 331
9 10
10 332
10 333
10 11
11 334
11 335
11 12
12 336
12 337
12 13
13 338
13 339
13 14
14 340
14 341
14 15
15 342
15 343
15 16
16 344
16 345
16...

result:

ok 

Test #27:

score: 0
Accepted
time: 14ms
memory: 50904kb

input:

924 6
30 26 21 8 12 42 26

output:

923 14203740
1 462
1 463
1 2
2 464
2 3
3 465
3 4
4 466
4 5
5 467
5 6
6 468
6 7
7 469
7 8
8 470
8 9
9 471
9 10
10 472
10 11
11 473
11 12
12 474
12 13
13 475
13 14
14 476
14 15
15 477
15 16
16 478
16 17
17 479
17 18
18 480
18 19
19 481
19 20
20 482
20 21
21 483
21 22
22 484
22 23
23 485
23 24
24 486
2...

result:

ok 

Test #28:

score: 0
Accepted
time: 13ms
memory: 52660kb

input:

902 8
8 48 35 25 32 28 21 2 44

output:

901 13244886
1 901
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 5...

result:

ok 

Test #29:

score: 0
Accepted
time: 19ms
memory: 52824kb

input:

1021 2
11 16 14

output:

1020 977447
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 2
2 29
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 72
2 73
2 74...

result:

ok 

Test #30:

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

input:

1 9
18 7 32 20 44 12 15 38 14 43

output:

0 18

result:

ok 

Test #31:

score: 0
Accepted
time: 12ms
memory: 53592kb

input:

1060 3
22 35 14 10

output:

1059 3631294
1 68
1 69
1 2
2 70
2 71
2 72
2 73
2 74
2 75
2 76
2 77
2 78
2 79
2 80
2 81
2 82
2 83
2 84
2 3
3 85
3 86
3 87
3 88
3 89
3 90
3 91
3 92
3 93
3 94
3 95
3 96
3 97
3 98
3 99
3 4
4 100
4 101
4 102
4 103
4 104
4 105
4 106
4 107
4 108
4 109
4 110
4 111
4 112
4 113
4 114
4 5
5 115
5 116
5 117
5 1...

result:

ok 

Test #32:

score: 0
Accepted
time: 13ms
memory: 56080kb

input:

1174 9
43 31 31 48 26 3 12 24 44 15

output:

1173 32850542
1 587
1 588
1 2
2 589
2 3
3 590
3 4
4 591
4 5
5 592
5 6
6 593
6 7
7 594
7 8
8 595
8 9
9 596
9 10
10 597
10 11
11 598
11 12
12 599
12 13
13 600
13 14
14 601
14 15
15 602
15 16
16 603
16 17
17 604
17 18
18 605
18 19
19 606
19 20
20 607
20 21
21 608
21 22
22 609
22 23
23 610
23 24
24 611
...

result:

ok 

Test #33:

score: 0
Accepted
time: 21ms
memory: 55172kb

input:

1132 7
22 41 20 40 1 45 15 41

output:

1131 30428525
1 566
1 567
1 2
2 568
2 3
3 569
3 4
4 570
4 5
5 571
5 6
6 572
6 7
7 573
7 8
8 574
8 9
9 575
9 10
10 576
10 11
11 577
11 12
12 578
12 13
13 579
13 14
14 580
14 15
15 581
15 16
16 582
16 17
17 583
17 18
18 584
18 19
19 585
19 20
20 586
20 21
21 587
21 22
22 588
22 23
23 589
23 24
24 590
...

result:

ok 

Test #34:

score: 0
Accepted
time: 17ms
memory: 55376kb

input:

1144 7
44 11 38 25 10 46 39 14

output:

1143 13475451
1 230
1 231
1 2
2 232
2 233
2 234
2 235
2 3
3 236
3 237
3 238
3 239
3 4
4 240
4 241
4 242
4 243
4 5
5 244
5 245
5 246
5 247
5 6
6 248
6 249
6 250
6 251
6 7
7 252
7 253
7 254
7 255
7 8
8 256
8 257
8 258
8 259
8 9
9 260
9 261
9 262
9 263
9 10
10 264
10 265
10 266
10 267
10 11
11 268
11 2...

result:

ok 

Test #35:

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

input:

143 1
20 39

output:

142 13936
1 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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 6...

result:

ok 

Test #36:

score: 0
Accepted
time: 13ms
memory: 56532kb

input:

1193 8
13 14 30 29 27 45 20 50 12

output:

1192 23190532
1 597
1 2
2 598
2 3
3 599
3 4
4 600
4 5
5 601
5 6
6 602
6 7
7 603
7 8
8 604
8 9
9 605
9 10
10 606
10 11
11 607
11 12
12 608
12 13
13 609
13 14
14 610
14 15
15 611
15 16
16 612
16 17
17 613
17 18
18 614
18 19
19 615
19 20
20 616
20 21
21 617
21 22
22 618
22 23
23 619
23 24
24 620
24 25
...

result:

ok 

Test #37:

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

input:

1246 2
36 21 13

output:

1245 1190316
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 2
2 30
2 31
2 32
2 33
2 34
2 35
2 36
2 37
2 38
2 39
2 40
2 41
2 42
2 43
2 44
2 45
2 46
2 47
2 48
2 49
2 50
2 51
2 52
2 53
2 54
2 55
2 56
2 57
2 58
2 59
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 72
2 73
2 74
2 75
2 76
2 7...

result:

ok 

Test #38:

score: 0
Accepted
time: 14ms
memory: 60628kb

input:

1282 6
32 30 38 2 32 22 30

output:

1281 19528052
1 641
1 642
1 2
2 643
2 3
3 644
3 4
4 645
4 5
5 646
5 6
6 647
6 7
7 648
7 8
8 649
8 9
9 650
9 10
10 651
10 11
11 652
11 12
12 653
12 13
13 654
13 14
14 655
14 15
15 656
15 16
16 657
16 17
17 658
17 18
18 659
18 19
19 660
19 20
20 661
20 21
21 662
21 22
22 663
22 23
23 664
23 24
24 665
...

result:

ok 

Test #39:

score: 0
Accepted
time: 16ms
memory: 59096kb

input:

1219 5
1 18 2 24 13 41

output:

1218 19108189
1 407
1 408
1 2
2 409
2 410
2 3
3 411
3 412
3 4
4 413
4 414
4 5
5 415
5 416
5 6
6 417
6 418
6 7
7 419
7 420
7 8
8 421
8 422
8 9
9 423
9 424
9 10
10 425
10 426
10 11
11 427
11 428
11 12
12 429
12 430
12 13
13 431
13 432
13 14
14 433
14 434
14 15
15 435
15 436
15 16
16 437
16 438
16 17
1...

result:

ok 

Test #40:

score: 0
Accepted
time: 11ms
memory: 60452kb

input:

1275 7
1 2 2 10 48 11 39 18

output:

1274 12159175
1 214
1 2
2 215
2 216
2 217
2 218
2 219
2 3
3 220
3 221
3 222
3 223
3 224
3 4
4 225
4 226
4 227
4 228
4 229
4 5
5 230
5 231
5 232
5 233
5 234
5 6
6 235
6 236
6 237
6 238
6 239
6 7
7 240
7 241
7 242
7 243
7 244
7 8
8 245
8 246
8 247
8 248
8 249
8 9
9 250
9 251
9 252
9 253
9 254
9 10
10 ...

result:

ok 

Test #41:

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

input:

1204 6
42 39 31 45 1 45 15

output:

1203 20981458
1 402
1 403
1 2
2 404
2 405
2 3
3 406
3 407
3 4
4 408
4 409
4 5
5 410
5 411
5 6
6 412
6 413
6 7
7 414
7 415
7 8
8 416
8 417
8 9
9 418
9 419
9 10
10 420
10 421
10 11
11 422
11 423
11 12
12 424
12 425
12 13
13 426
13 427
13 14
14 428
14 429
14 15
15 430
15 431
15 16
16 432
16 433
16 17
1...

result:

ok 

Test #42:

score: 0
Accepted
time: 8ms
memory: 64376kb

input:

1433 6
36 45 32 28 2 47 35

output:

1432 27559374
1 717
1 2
2 718
2 3
3 719
3 4
4 720
4 5
5 721
5 6
6 722
6 7
7 723
7 8
8 724
8 9
9 725
9 10
10 726
10 11
11 727
11 12
12 728
12 13
13 729
13 14
14 730
14 15
15 731
15 16
16 732
16 17
17 733
17 18
18 734
18 19
19 735
19 20
20 736
20 21
21 737
21 22
22 738
22 23
23 739
23 24
24 740
24 25
...

result:

ok 

Test #43:

score: 0
Accepted
time: 4ms
memory: 63596kb

input:

1479 4
19 20 14 40 48

output:

1478 13245633
1 371
1 2
2 372
2 373
2 374
2 3
3 375
3 376
3 377
3 4
4 378
4 379
4 380
4 5
5 381
5 382
5 383
5 6
6 384
6 385
6 386
6 7
7 387
7 388
7 389
7 8
8 390
8 391
8 392
8 9
9 393
9 394
9 395
9 10
10 396
10 397
10 398
10 11
11 399
11 400
11 401
11 12
12 402
12 403
12 404
12 13
13 405
13 406
13 4...

result:

ok 

Test #44:

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

input:

1416 5
13 30 1 3 23 37

output:

1415 20881768
1 473
1 2
2 474
2 475
2 3
3 476
3 477
3 4
4 478
4 479
4 5
5 480
5 481
5 6
6 482
6 483
6 7
7 484
7 485
7 8
8 486
8 487
8 9
9 488
9 489
9 10
10 490
10 491
10 11
11 492
11 493
11 12
12 494
12 495
12 13
13 496
13 497
13 14
14 498
14 499
14 15
15 500
15 501
15 16
16 502
16 503
16 17
17 504
...

result:

ok 

Test #45:

score: 0
Accepted
time: 13ms
memory: 62656kb

input:

1366 2
23 7 45

output:

1365 2381528
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 2
2 74
2 75
2 76
2 77
2 78
2 79
2 80
2 81
2 82
2 83
2 84
2 85
2 86
2 87
2 88
2 89
2 90
2 91
2 92
2 93
2 94
2 95
2 9...

result:

ok 

Test #46:

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

input:

69 8
9 37 11 27 24 20 26 29 34

output:

68 1060969
1 24
1 2
2 25
2 26
2 3
3 27
3 28
3 4
4 29
4 30
4 5
5 31
5 32
5 6
6 33
6 34
6 7
7 35
7 36
7 8
8 37
8 38
8 9
9 39
9 40
9 10
10 41
10 42
10 11
11 43
11 44
11 12
12 45
12 46
12 13
13 47
13 48
13 14
14 49
14 50
14 15
15 51
15 52
15 16
16 53
16 54
16 17
17 55
17 56
17 18
18 57
18 58
18 19
19 59...

result:

ok 

Test #47:

score: 0
Accepted
time: 19ms
memory: 62724kb

input:

1446 1
31 40

output:

1445 160426
1 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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1...

result:

ok 

Test #48:

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

input:

1558 7
1 20 1 18 19 32 23 31

output:

1557 27375776
1 779
1 780
1 2
2 781
2 3
3 782
3 4
4 783
4 5
5 784
5 6
6 785
6 7
7 786
7 8
8 787
8 9
9 788
9 10
10 789
10 11
11 790
11 12
12 791
12 13
13 792
13 14
14 793
14 15
15 794
15 16
16 795
16 17
17 796
17 18
18 797
18 19
19 798
19 20
20 799
20 21
21 800
21 22
22 801
22 23
23 802
23 24
24 803
...

result:

ok 

Test #49:

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

input:

1506 6
13 11 47 4 16 12 23

output:

1505 26313135
1 503
1 2
2 504
2 505
2 3
3 506
3 507
3 4
4 508
4 509
4 5
5 510
5 511
5 6
6 512
6 513
6 7
7 514
7 515
7 8
8 516
8 517
8 9
9 518
9 519
9 10
10 520
10 521
10 11
11 522
11 523
11 12
12 524
12 525
12 13
13 526
13 527
13 14
14 528
14 529
14 15
15 530
15 531
15 16
16 532
16 533
16 17
17 534
...

result:

ok 

Test #50:

score: 0
Accepted
time: 20ms
memory: 64176kb

input:

1502 10
7 28 34 22 15 12 39 22 3 12 1

output:

1501 30324390
1 751
1 752
1 2
2 753
2 3
3 754
3 4
4 755
4 5
5 756
5 6
6 757
6 7
7 758
7 8
8 759
8 9
9 760
9 10
10 761
10 11
11 762
11 12
12 763
12 13
13 764
13 14
14 765
14 15
15 766
15 16
16 767
16 17
17 768
17 18
18 769
18 19
19 770
19 20
20 771
20 21
21 772
21 22
22 773
22 23
23 774
23 24
24 775
...

result:

ok 

Test #51:

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

input:

1554 6
40 26 7 34 32 25 10

output:

1553 17872648
1 312
1 313
1 2
2 314
2 315
2 316
2 317
2 3
3 318
3 319
3 320
3 321
3 4
4 322
4 323
4 324
4 325
4 5
5 326
5 327
5 328
5 329
5 6
6 330
6 331
6 332
6 333
6 7
7 334
7 335
7 336
7 337
7 8
8 338
8 339
8 340
8 341
8 9
9 342
9 343
9 344
9 345
9 10
10 346
10 347
10 348
10 349
10 11
11 350
11 3...

result:

ok 

Test #52:

score: 0
Accepted
time: 12ms
memory: 70272kb

input:

1641 6
4 4 50 32 36 21 45

output:

1640 34686354
1 821
1 2
2 822
2 3
3 823
3 4
4 824
4 5
5 825
5 6
6 826
6 7
7 827
7 8
8 828
8 9
9 829
9 10
10 830
10 11
11 831
11 12
12 832
12 13
13 833
13 14
14 834
14 15
15 835
15 16
16 836
16 17
17 837
17 18
18 838
18 19
19 839
19 20
20 840
20 21
21 841
21 22
22 842
22 23
23 843
23 24
24 844
24 25
...

result:

ok 

Test #53:

score: 0
Accepted
time: 15ms
memory: 70116kb

input:

1704 9
34 25 28 32 46 31 13 5 10 3

output:

1703 33186050
1 852
1 853
1 2
2 854
2 3
3 855
3 4
4 856
4 5
5 857
5 6
6 858
6 7
7 859
7 8
8 860
8 9
9 861
9 10
10 862
10 11
11 863
11 12
12 864
12 13
13 865
13 14
14 866
14 15
15 867
15 16
16 868
16 17
17 869
17 18
18 870
18 19
19 871
19 20
20 872
20 21
21 873
21 22
22 874
22 23
23 875
23 24
24 876
...

result:

ok 

Test #54:

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

input:

1729 10
1 45 47 48 14 11 16 5 44 43 39

output:

1728 28886428
1 1728
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...

result:

ok 

Test #55:

score: 0
Accepted
time: 20ms
memory: 69108kb

input:

1674 8
46 26 8 27 50 42 16 8 14

output:

1673 24479277
1 559
1 2
2 560
2 561
2 3
3 562
3 563
3 4
4 564
4 565
4 5
5 566
5 567
5 6
6 568
6 569
6 7
7 570
7 571
7 8
8 572
8 573
8 9
9 574
9 575
9 10
10 576
10 577
10 11
11 578
11 579
11 12
12 580
12 581
12 13
13 582
13 583
13 14
14 584
14 585
14 15
15 586
15 587
15 16
16 588
16 589
16 17
17 590
...

result:

ok 

Test #56:

score: 0
Accepted
time: 13ms
memory: 72804kb

input:

1791 5
2 4 36 30 27 46

output:

1790 33867308
1 598
1 2
2 599
2 600
2 3
3 601
3 602
3 4
4 603
4 604
4 5
5 605
5 606
5 6
6 607
6 608
6 7
7 609
7 610
7 8
8 611
8 612
8 9
9 613
9 614
9 10
10 615
10 616
10 11
11 617
11 618
11 12
12 619
12 620
12 13
13 621
13 622
13 14
14 623
14 624
14 15
15 625
15 626
15 16
16 627
16 628
16 17
17 629
...

result:

ok 

Test #57:

score: 0
Accepted
time: 12ms
memory: 43952kb

input:

219 6
11 26 45 49 10 1 14

output:

218 3123505
1 56
1 2
2 57
2 58
2 59
2 3
3 60
3 61
3 62
3 4
4 63
4 64
4 65
4 5
5 66
5 67
5 68
5 6
6 69
6 70
6 71
6 7
7 72
7 73
7 74
7 8
8 75
8 76
8 77
8 9
9 78
9 79
9 80
9 10
10 81
10 82
10 83
10 11
11 84
11 85
11 86
11 12
12 87
12 88
12 89
12 13
13 90
13 91
13 92
13 14
14 93
14 94
14 95
14 15
15 96
...

result:

ok 

Test #58:

score: 0
Accepted
time: 12ms
memory: 72268kb

input:

1774 3
39 29 31 6

output:

1773 5370690
1 100
1 101
1 102
1 103
1 104
1 105
1 106
1 107
1 2
2 108
2 109
2 110
2 111
2 112
2 113
2 114
2 115
2 116
2 117
2 118
2 119
2 120
2 121
2 122
2 123
2 124
2 3
3 125
3 126
3 127
3 128
3 129
3 130
3 131
3 132
3 133
3 134
3 135
3 136
3 137
3 138
3 139
3 140
3 141
3 4
4 142
4 143
4 144
4 145...

result:

ok 

Test #59:

score: 0
Accepted
time: 34ms
memory: 74092kb

input:

1830 6
25 31 32 37 2 1 43

output:

1829 30462134
1 915
1 916
1 2
2 917
2 3
3 918
3 4
4 919
4 5
5 920
5 6
6 921
6 7
7 922
7 8
8 923
8 9
9 924
9 10
10 925
10 11
11 926
11 12
12 927
12 13
13 928
13 14
14 929
14 15
15 930
15 16
16 931
16 17
17 932
17 18
18 933
18 19
19 934
19 20
20 935
20 21
21 936
21 22
22 937
22 23
23 938
23 24
24 939
...

result:

ok 

Test #60:

score: 0
Accepted
time: 25ms
memory: 77960kb

input:

1886 5
36 33 10 5 16 31

output:

1885 23079262
1 629
1 630
1 631
1 2
2 632
2 633
2 3
3 634
3 635
3 4
4 636
4 637
4 5
5 638
5 639
5 6
6 640
6 641
6 7
7 642
7 643
7 8
8 644
8 645
8 9
9 646
9 647
9 10
10 648
10 649
10 11
11 650
11 651
11 12
12 652
12 653
12 13
13 654
13 655
13 14
14 656
14 657
14 15
15 658
15 659
15 16
16 660
16 661
1...

result:

ok 

Test #61:

score: 0
Accepted
time: 21ms
memory: 76616kb

input:

1907 7
9 37 49 23 34 14 29 24

output:

1906 20753757
1 954
1 2
2 955
2 3
3 956
3 4
4 957
4 5
5 958
5 6
6 959
6 7
7 960
7 8
8 961
8 9
9 962
9 10
10 963
10 11
11 964
11 12
12 965
12 13
13 966
13 14
14 967
14 15
15 968
15 16
16 969
16 17
17 970
17 18
18 971
18 19
19 972
19 20
20 973
20 21
21 974
21 22
22 975
22 23
23 976
23 24
24 977
24 25
...

result:

ok 

Test #62:

score: 0
Accepted
time: 11ms
memory: 74408kb

input:

1840 2
30 14 7

output:

1839 1289412
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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 2
2 60
2 61
2 62
2 63
2 64
2 65
2 66
2 67
2 68
2 69
2 70
2 71
2 72
2 73
2 74
2 75
2 76
2 77
2 7...

result:

ok 

Test #63:

score: 0
Accepted
time: 16ms
memory: 74632kb

input:

1845 3
46 42 35 46

output:

1844 10496398
1 206
1 207
1 208
1 209
1 210
1 211
1 212
1 2
2 213
2 214
2 215
2 216
2 217
2 218
2 219
2 220
2 3
3 221
3 222
3 223
3 224
3 225
3 226
3 227
3 228
3 4
4 229
4 230
4 231
4 232
4 233
4 234
4 235
4 236
4 5
5 237
5 238
5 239
5 240
5 241
5 242
5 243
5 244
5 6
6 245
6 246
6 247
6 248
6 249
6 ...

result:

ok 

Test #64:

score: 0
Accepted
time: 15ms
memory: 80932kb

input:

2029 2
41 7 2

output:

2028 808537
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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 7...

result:

ok 

Test #65:

score: 0
Accepted
time: 36ms
memory: 82840kb

input:

2084 7
40 34 44 27 31 24 50 14

output:

2083 37527190
1 695
1 696
1 697
1 2
2 698
2 699
2 3
3 700
3 701
3 4
4 702
4 703
4 5
5 704
5 705
5 6
6 706
6 707
6 7
7 708
7 709
7 8
8 710
8 711
8 9
9 712
9 713
9 10
10 714
10 715
10 11
11 716
11 717
11 12
12 718
12 719
12 13
13 720
13 721
13 14
14 722
14 723
14 15
15 724
15 725
15 16
16 726
16 727
1...

result:

ok 

Test #66:

score: 0
Accepted
time: 21ms
memory: 79824kb

input:

2002 9
9 8 5 42 1 3 24 27 42 41

output:

2001 74458404
1 2001
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...

result:

ok 

Test #67:

score: 0
Accepted
time: 21ms
memory: 80360kb

input:

2013 6
40 34 25 24 15 45 29

output:

2012 35161186
1 672
1 673
1 2
2 674
2 3
3 675
3 676
3 4
4 677
4 678
4 5
5 679
5 680
5 6
6 681
6 682
6 7
7 683
7 684
7 8
8 685
8 686
8 9
9 687
9 688
9 10
10 689
10 690
10 11
11 691
11 692
11 12
12 693
12 694
12 13
13 695
13 696
13 14
14 697
14 698
14 15
15 699
15 700
15 16
16 701
16 702
16 17
17 703
...

result:

ok 

Test #68:

score: 0
Accepted
time: 12ms
memory: 41808kb

input:

199 5
17 8 15 42 48 4

output:

198 2382209
1 51
1 2
2 52
2 53
2 54
2 3
3 55
3 56
3 57
3 4
4 58
4 59
4 60
4 5
5 61
5 62
5 63
5 6
6 64
6 65
6 66
6 7
7 67
7 68
7 69
7 8
8 70
8 71
8 72
8 9
9 73
9 74
9 75
9 10
10 76
10 77
10 78
10 11
11 79
11 80
11 81
11 12
12 82
12 83
12 84
12 13
13 85
13 86
13 87
13 14
14 88
14 89
14 90
14 15
15 91
...

result:

ok 

Test #69:

score: 0
Accepted
time: 17ms
memory: 78572kb

input:

1966 7
37 19 37 24 32 9 37 14

output:

1965 29203766
1 657
1 2
2 3
3 658
3 659
3 4
4 660
4 661
4 5
5 662
5 663
5 6
6 664
6 665
6 7
7 666
7 667
7 8
8 668
8 669
8 9
9 670
9 671
9 10
10 672
10 673
10 11
11 674
11 675
11 12
12 676
12 677
12 13
13 678
13 679
13 14
14 680
14 681
14 15
15 682
15 683
15 16
16 684
16 685
16 17
17 686
17 687
17 18...

result:

ok 

Test #70:

score: 0
Accepted
time: 8ms
memory: 87696kb

input:

2211 5
49 7 4 27 10 6

output:

2210 15935989
1 554
1 2
2 555
2 556
2 557
2 3
3 558
3 559
3 560
3 4
4 561
4 562
4 563
4 5
5 564
5 565
5 566
5 6
6 567
6 568
6 569
6 7
7 570
7 571
7 572
7 8
8 573
8 574
8 575
8 9
9 576
9 577
9 578
9 10
10 579
10 580
10 581
10 11
11 582
11 583
11 584
11 12
12 585
12 586
12 587
12 13
13 588
13 589
13 5...

result:

ok 

Test #71:

score: 0
Accepted
time: 17ms
memory: 86688kb

input:

2187 7
33 36 31 49 29 15 43 18

output:

2186 21094741
1 1094
1 2
2 1095
2 3
3 1096
3 4
4 1097
4 5
5 1098
5 6
6 1099
6 7
7 1100
7 8
8 1101
8 9
9 1102
9 10
10 1103
10 11
11 1104
11 12
12 1105
12 13
13 1106
13 14
14 1107
14 15
15 1108
15 16
16 1109
16 17
17 1110
17 18
18 1111
18 19
19 1112
19 20
20 1113
20 21
21 1114
21 22
22 1115
22 23
23 1...

result:

ok 

Test #72:

score: 0
Accepted
time: 17ms
memory: 85428kb

input:

2155 6
20 28 43 19 45 19 40

output:

2154 41581356
1 1078
1 2
2 1079
2 3
3 1080
3 4
4 1081
4 5
5 1082
5 6
6 1083
6 7
7 1084
7 8
8 1085
8 9
9 1086
9 10
10 1087
10 11
11 1088
11 12
12 1089
12 13
13 1090
13 14
14 1091
14 15
15 1092
15 16
16 1093
16 17
17 1094
17 18
18 1095
18 19
19 1096
19 20
20 1097
20 21
21 1098
21 22
22 1099
22 23
23 1...

result:

ok 

Test #73:

score: 0
Accepted
time: 15ms
memory: 84048kb

input:

2116 8
15 11 9 46 41 24 2 17 37

output:

2115 57657640
1 1058
1 1059
1 2
2 1060
2 3
3 1061
3 4
4 1062
4 5
5 1063
5 6
6 1064
6 7
7 1065
7 8
8 1066
8 9
9 1067
9 10
10 1068
10 11
11 1069
11 12
12 1070
12 13
13 1071
13 14
14 1072
14 15
15 1073
15 16
16 1074
16 17
17 1075
17 18
18 1076
18 19
19 1077
19 20
20 1078
20 21
21 1079
21 22
22 1080
22 ...

result:

ok 

Test #74:

score: 0
Accepted
time: 23ms
memory: 90520kb

input:

2235 4
46 43 36 45 46

output:

2234 20192476
1 560
1 2
2 561
2 562
2 563
2 3
3 564
3 565
3 566
3 4
4 567
4 568
4 569
4 5
5 570
5 571
5 572
5 6
6 573
6 574
6 575
6 7
7 576
7 577
7 578
7 8
8 579
8 580
8 581
8 9
9 582
9 583
9 584
9 10
10 585
10 586
10 587
10 11
11 588
11 589
11 590
11 12
12 591
12 592
12 593
12 13
13 594
13 595
13 5...

result:

ok 

Test #75:

score: 0
Accepted
time: 26ms
memory: 96640kb

input:

2386 6
33 46 3 3 36 47 3

output:

2385 23421354
1 597
1 598
1 599
1 600
1 2
2 601
2 602
2 603
2 3
3 604
3 605
3 606
3 4
4 607
4 608
4 609
4 5
5 610
5 611
5 612
5 6
6 613
6 614
6 615
6 7
7 616
7 617
7 618
7 8
8 619
8 620
8 621
8 9
9 622
9 623
9 624
9 10
10 625
10 626
10 627
10 11
11 628
11 629
11 630
11 12
12 631
12 632
12 633
12 13
...

result:

ok 

Test #76:

score: 0
Accepted
time: 28ms
memory: 89408kb

input:

2256 5
44 29 21 9 14 34

output:

2255 32619088
1 565
1 566
1 567
1 2
2 568
2 569
2 3
3 570
3 571
3 572
3 4
4 573
4 574
4 575
4 5
5 576
5 577
5 578
5 6
6 579
6 580
6 581
6 7
7 582
7 583
7 584
7 8
8 585
8 586
8 587
8 9
9 588
9 589
9 590
9 10
10 591
10 592
10 593
10 11
11 594
11 595
11 596
11 12
12 597
12 598
12 599
12 13
13 600
13 60...

result:

ok 

Test #77:

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

input:

2262 9
21 4 35 10 47 35 37 25 48 34

output:

2261 84490692
1 2261
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...

result:

ok 

Test #78:

score: 0
Accepted
time: 29ms
memory: 91444kb

input:

2257 7
26 17 20 30 32 11 41 13

output:

2256 35113744
1 752
1 753
1 754
1 2
2 755
2 756
2 3
3 757
3 758
3 4
4 759
4 760
4 5
5 761
5 762
5 6
6 763
6 764
6 7
7 765
7 766
7 8
8 767
8 768
8 9
9 769
9 770
9 10
10 771
10 772
10 11
11 773
11 774
11 12
12 775
12 776
12 13
13 777
13 778
13 14
14 779
14 780
14 15
15 781
15 782
15 16
16 783
16 784
1...

result:

ok 

Test #79:

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

input:

226 8
34 21 19 16 21 28 2 37 39

output:

225 5680290
1 113
1 114
1 2
2 115
2 3
3 116
3 4
4 117
4 5
5 118
5 6
6 119
6 7
7 120
7 8
8 121
8 9
9 122
9 10
10 123
10 11
11 124
11 12
12 125
12 13
13 126
13 14
14 127
14 15
15 128
15 16
16 129
16 17
17 130
17 18
18 131
18 19
19 132
19 20
20 133
20 21
21 134
21 22
22 135
22 23
23 136
23 24
24 137
24...

result:

ok 

Test #80:

score: 0
Accepted
time: 12ms
memory: 94400kb

input:

2331 5
36 50 29 20 5 29

output:

2330 25841563
1 777
1 778
1 779
1 2
2 780
2 781
2 3
3 782
3 783
3 4
4 784
4 785
4 5
5 786
5 787
5 6
6 788
6 789
6 7
7 790
7 791
7 8
8 792
8 793
8 9
9 794
9 795
9 10
10 796
10 797
10 11
11 798
11 799
11 12
12 800
12 801
12 13
13 802
13 803
13 14
14 804
14 805
14 15
15 806
15 807
15 16
16 808
16 809
1...

result:

ok 

Test #81:

score: 0
Accepted
time: 20ms
memory: 97468kb

input:

2454 6
34 22 1 23 44 1 27

output:

2453 29880376
1 1227
1 1228
1 2
2 1229
2 3
3 1230
3 4
4 1231
4 5
5 1232
5 6
6 1233
6 7
7 1234
7 8
8 1235
8 9
9 1236
9 10
10 1237
10 11
11 1238
11 12
12 1239
12 13
13 1240
13 14
14 1241
14 15
15 1242
15 16
16 1243
16 17
17 1244
17 18
18 1245
18 19
19 1246
19 20
20 1247
20 21
21 1248
21 22
22 1249
22 ...

result:

ok 

Test #82:

score: 0
Accepted
time: 16ms
memory: 101080kb

input:

2493 1
6 37

output:

2492 199366
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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
...

result:

ok 

Test #83:

score: 0
Accepted
time: 20ms
memory: 97292kb

input:

2449 9
15 44 43 25 41 9 49 37 50 25

output:

2448 85378953
1 2448
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...

result:

ok 

Test #84:

score: 0
Accepted
time: 28ms
memory: 98236kb

input:

2424 4
26 19 47 14 30

output:

2423 21435242
1 486
1 487
1 2
2 488
2 489
2 490
2 491
2 3
3 492
3 493
3 494
3 495
3 4
4 496
4 497
4 498
4 499
4 5
5 500
5 501
5 502
5 503
5 6
6 504
6 505
6 506
6 507
6 7
7 508
7 509
7 510
7 511
7 8
8 512
8 513
8 514
8 515
8 9
9 516
9 517
9 518
9 519
9 10
10 520
10 521
10 522
10 523
10 11
11 524
11 5...

result:

ok 

Test #85:

score: 0
Accepted
time: 16ms
memory: 99632kb

input:

2510 9
50 17 37 5 25 10 5 27 18 35

output:

2509 68458826
1 2509
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...

result:

ok 

Test #86:

score: 0
Accepted
time: 21ms
memory: 101764kb

input:

2600 4
16 19 18 19 49

output:

2599 22021756
1 651
1 652
1 2
2 653
2 654
2 655
2 3
3 656
3 657
3 658
3 4
4 659
4 660
4 661
4 5
5 662
5 663
5 664
5 6
6 665
6 666
6 667
6 7
7 668
7 669
7 670
7 8
8 671
8 672
8 673
8 9
9 674
9 675
9 676
9 10
10 677
10 678
10 679
10 11
11 680
11 681
11 682
11 12
12 683
12 684
12 685
12 13
13 686
13 68...

result:

ok 

Test #87:

score: 0
Accepted
time: 28ms
memory: 106116kb

input:

2695 7
25 39 43 5 29 2 49 24

output:

2694 43794209
1 1348
1 2
2 1349
2 3
3 1350
3 4
4 1351
4 5
5 1352
5 6
6 1353
6 7
7 1354
7 8
8 1355
8 9
9 1356
9 10
10 1357
10 11
11 1358
11 12
12 1359
12 13
13 1360
13 14
14 1361
14 15
15 1362
15 16
16 1363
16 17
17 1364
17 18
18 1365
18 19
19 1366
19 20
20 1367
20 21
21 1368
21 22
22 1369
22 23
23 1...

result:

ok 

Test #88:

score: 0
Accepted
time: 39ms
memory: 105252kb

input:

2661 10
49 45 22 28 7 50 45 33 33 18 13

output:

2660 107006823
1 2660
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
5...

result:

ok 

Test #89:

score: 0
Accepted
time: 36ms
memory: 104452kb

input:

2626 7
40 5 15 8 28 13 22 12

output:

2625 63314782
1 1313
1 1314
1 2
2 1315
2 3
3 1316
3 4
4 1317
4 5
5 1318
5 6
6 1319
6 7
7 1320
7 8
8 1321
8 9
9 1322
9 10
10 1323
10 11
11 1324
11 12
12 1325
12 13
13 1326
13 14
14 1327
14 15
15 1328
15 16
16 1329
16 17
17 1330
17 18
18 1331
18 19
19 1332
19 20
20 1333
20 21
21 1334
21 22
22 1335
22 ...

result:

ok 

Test #90:

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

input:

255 4
11 1 4 13 42

output:

254 2896197
1 52
1 53
1 54
1 2
2 55
2 56
2 57
2 58
2 3
3 59
3 60
3 61
3 62
3 4
4 63
4 64
4 65
4 66
4 5
5 67
5 68
5 69
5 70
5 6
6 71
6 72
6 73
6 74
6 7
7 75
7 76
7 77
7 78
7 8
8 79
8 80
8 81
8 82
8 9
9 83
9 84
9 85
9 86
9 10
10 87
10 88
10 89
10 90
10 11
11 91
11 92
11 93
11 94
11 12
12 95
12 96
12 9...

result:

ok 

Test #91:

score: 0
Accepted
time: 21ms
memory: 102944kb

input:

2563 7
40 13 13 37 28 21 8 24

output:

2562 35788764
1 854
1 855
1 856
1 2
2 857
2 858
2 3
3 859
3 860
3 4
4 861
4 862
4 5
5 863
5 864
5 6
6 865
6 866
6 7
7 867
7 868
7 8
8 869
8 870
8 9
9 871
9 872
9 10
10 873
10 874
10 11
11 875
11 876
11 12
12 877
12 878
12 13
13 879
13 880
13 14
14 881
14 882
14 15
15 883
15 884
15 16
16 885
16 886
1...

result:

ok 

Test #92:

score: 0
Accepted
time: 24ms
memory: 105628kb

input:

2768 8
25 18 26 34 13 30 47 6 47

output:

2767 48164850
1 2767
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...

result:

ok 

Test #93:

score: 0
Accepted
time: 24ms
memory: 105396kb

input:

2757 8
31 36 12 14 35 43 44 19 21

output:

2756 65276248
1 1379
1 2
2 1380
2 3
3 1381
3 4
4 1382
4 5
5 1383
5 6
6 1384
6 7
7 1385
7 8
8 1386
8 9
9 1387
9 10
10 1388
10 11
11 1389
11 12
12 1390
12 13
13 1391
13 14
14 1392
14 15
15 1393
15 16
16 1394
16 17
17 1395
17 18
18 1396
18 19
19 1397
19 20
20 1398
20 21
21 1399
21 22
22 1400
22 23
23 1...

result:

ok 

Test #94:

score: 0
Accepted
time: 40ms
memory: 105020kb

input:

2739 9
43 26 15 47 1 50 41 45 23 49

output:

2738 113605339
1 2738
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
5...

result:

ok 

Test #95:

score: 0
Accepted
time: 29ms
memory: 104584kb

input:

2719 9
6 17 3 39 27 7 37 36 35 1

output:

2718 47460972
1 2718
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...

result:

ok 

Test #96:

score: 0
Accepted
time: 29ms
memory: 106376kb

input:

2793 9
2 50 17 43 35 38 32 6 47 50

output:

2792 119282398
1 2792
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
5...

result:

ok 

Test #97:

score: 0
Accepted
time: 38ms
memory: 108332kb

input:

2879 8
12 7 41 14 5 9 34 25 16

output:

2878 29178860
1 2878
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...

result:

ok 

Test #98:

score: 0
Accepted
time: 12ms
memory: 111936kb

input:

2997 1
6 29

output:

2996 191750
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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
...

result:

ok 

Test #99:

score: 0
Accepted
time: 29ms
memory: 110472kb

input:

2993 8
2 50 21 40 45 19 9 36 30

output:

2992 81471772
1 1497
1 2
2 1498
2 3
3 1499
3 4
4 1500
4 5
5 1501
5 6
6 1502
6 7
7 1503
7 8
8 1504
8 9
9 1505
9 10
10 1506
10 11
11 1507
11 12
12 1508
12 13
13 1509
13 14
14 1510
14 15
15 1511
15 16
16 1512
16 17
17 1513
17 18
18 1514
18 19
19 1515
19 20
20 1516
20 21
21 1517
21 22
22 1518
22 23
23 1...

result:

ok 

Test #100:

score: 0
Accepted
time: 32ms
memory: 110872kb

input:

2993 1
9 45

output:

2992 296217
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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1 62...

result:

ok