QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#643322#3040. ContainerDEMONKILLERAC ✓3ms11956kbC++202.3kb2024-10-15 20:41:142024-10-15 20:41:16

Judging History

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

  • [2024-10-15 20:41:16]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:11956kb
  • [2024-10-15 20:41:14]
  • 提交

answer

#include<bits/stdc++.h>
#define N 1010
#define Pii pair<int,int>
#define Fi first
#define Se second
using namespace std;
const int Inf=2e9;
char s[N];
vector<Pii> Res;
vector<int> Pos[2],L,R;
int Sub,n,C,Num,pos[N],to[N],Sum[2][N],f[N][N],g[N][N];
int main(){
    // freopen("machine.in","r",stdin);
    // freopen("machine.out","w",stdout);
    scanf("%d%d%s",&n,&C,s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='2')pos[++Num]=i;
    scanf("%s",s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='2'){
            Sum[i&1][i]=1;
            Pos[i&1].emplace_back(i);
        }
    for(int i=0;i<=1;i++)
        for(int j=2;j<=n;j++)
            Sum[i][j]+=Sum[i][j-1];
    memset(f,0x3f,sizeof(f));
    f[0][0]=0;
    for(int i=1;i<=Num;i++)
        for(int j=0;j<i;j++)
            if(f[i][j]<Inf){
                if(j<Sum[0][n]){
                    int x=Pos[0][j];
                    int Dis=abs(pos[i]-x);
                    int Val=(Dis>>1)*(C+4)+(Dis&1)*(C+3)+max(0,Sum[1][x]-i+j+1);
                    if(f[i][j+1]>f[i-1][j]+Val){
                        g[i][j+1]=0;
                        f[i][j+1]=f[i-1][j]+Val;
                    }
                }
                if((i-j-1)<Sum[1][n]){
                    int x=Pos[1][i-j-1];
                    int Dis=abs(pos[i]-x);
                    int Val=(Dis>>1)*(C+4)+(Dis&1)*(C+3)+max(0,Sum[0][x]-j);
                    if(f[i][j]>f[i-1][j]+Val){
                        g[i][j]=1;
                        f[i][j]=f[i-1][j]+Val;
                    }
                }
            }
    int Cnt1=Sum[0][n],Cnt2=Sum[1][n];
    for(int i=Num;i;i--)
        if(!g[i][Cnt1])
            to[pos[i]]=Pos[0][--Cnt1];
        else to[pos[i]]=Pos[1][--Cnt2];
    for(int i=1;i<=Num;i++){
        if(pos[i]<to[pos[i]])L.emplace_back(pos[i]);
        else if(pos[i]>to[pos[i]])R.emplace_back(pos[i]);
    }
    reverse(L.begin(),L.end());
    for(int i:L){
        int l=i,r=to[i];
        while(r-l>1)
            Res.emplace_back(l,l+2),l+=2;
        if(r-l)Res.emplace_back(l,r);
    }
    for(int i:R){
        int l=to[i],r=i;
        while(r-l>1)
            Res.emplace_back(r-2,r),r-=2;
        if(r-l)Res.emplace_back(l,r);
    }
    printf("%d\n",Res.size());
    for(Pii i:Res)printf("%d %d\n",i.Fi,i.Se);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 8944kb

input:

5 2
11221
21112

output:

2
4 5
1 3

result:

ok good job!

Test #2:

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

input:

7 0
2212121
1212122

output:

4
6 7
4 6
2 4
1 2

result:

ok good job!

Test #3:

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

input:

7 2
2212121
1212122

output:

3
1 3
3 5
5 7

result:

ok good job!

Test #4:

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

input:

1 0
1
1

output:

0

result:

ok good job!

Test #5:

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

input:

1 100
2
2

output:

0

result:

ok good job!

Test #6:

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

input:

2 55
12
21

output:

1
1 2

result:

ok good job!

Test #7:

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

input:

3 100
112
211

output:

1
1 3

result:

ok good job!

Test #8:

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

input:

3 99
221
212

output:

1
2 3

result:

ok good job!

Test #9:

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

input:

3 98
111
111

output:

0

result:

ok good job!

Test #10:

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

input:

123 64
222111221111221122211121221221122122211222211112221221212121211221122212111212211222122212122221212121222121221112111112112
211112121222212221122212212122111121121212211211211212212211111221222212121121212222112212222211221211122212111211221122212

output:

110
114 116
110 112
109 111
111 113
113 115
115 117
117 119
119 121
107 109
109 111
111 113
113 115
115 117
117 119
105 107
107 109
109 111
111 113
113 115
104 106
106 108
103 105
105 106
101 103
103 105
99 101
101 103
103 104
97 99
99 100
95 97
94 96
96 98
92 94
90 92
88 90
87 89
89 91
86 88
83 85
...

result:

ok good job!

Test #11:

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

input:

337 42
12221211121211122121211211221211122221122211222222112211121111121211112112222111112212222222211111212211212211221111112121121211112121211222222211122211121211121121121212111112212211122122121112212122212121112111222222112112221222122112221121212212221222212211112211222211112212121221221222111...

output:

683
336 337
331 333
333 334
330 332
329 330
323 324
320 322
318 320
112 114
114 115
102 103
93 95
91 93
58 59
54 56
56 57
53 55
50 52
52 54
49 51
51 53
48 50
50 52
47 49
49 51
46 48
6 8
4 6
3 5
5 7
2 4
4 5
9 10
10 12
14 16
12 14
15 17
13 15
17 19
19 21
22 24
20 22
18 20
16 18
14 16
25 27
23 25
21 23...

result:

ok good job!

Test #12:

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

input:

312 225
1211111122221112212122121121211212111222121212112121211221211122121111121212211221122221212122111111121222121222112121122222222111111211212112222111222221122211222221122112212112121122222121212111121211212222211122212122111221212222122222122211222211221211111221112111121122222122122111211212...

output:

254
305 307
304 305
293 295
295 297
297 298
292 294
294 296
265 266
254 256
252 254
209 210
198 199
193 195
195 196
191 193
193 195
189 191
187 189
189 190
180 181
175 177
173 174
169 171
168 170
127 128
93 95
95 97
91 93
89 91
87 89
86 88
88 90
90 92
85 87
84 86
86 88
81 83
83 85
66 68
68 69
63 65
...

result:

ok good job!

Test #13:

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

input:

5 136
22111
21121

output:

1
2 4

result:

ok good job!

Test #14:

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

input:

401 518
2122122212112221121122221122212212111122222112211121112212211221211211111111111121222112122212122122112112222211212221212211221222212222211212211222221122212221121211112111221112211122121212112222122112122221112111112222121111122111221211212111211222112222112112211112122212111112211221111122...

output:

1263
398 399
396 398
393 395
386 388
388 390
390 392
392 394
384 386
386 388
388 390
390 392
383 385
385 387
387 389
389 391
391 393
381 383
383 385
385 387
387 389
378 380
380 382
382 384
384 386
386 388
375 377
377 379
379 381
381 383
383 385
372 374
374 376
376 378
378 380
380 382
382 384
384 386...

result:

ok good job!

Test #15:

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

input:

309 504
1122112211111111121121111122122122211211112122111211211212121221121122111212121112222121122211122111222122212112111112111221222111221212111111112112121211211222212212222122212112222222222211122111121112112122111211121222222211221121222111111211222121111221211111112111122111212111221212212211...

output:

769
257 259
249 251
251 252
247 249
246 248
245 247
242 244
235 237
237 239
239 241
234 236
236 238
238 239
233 235
235 237
228 230
230 232
232 234
234 236
227 229
223 225
222 223
3 5
16 18
14 16
12 14
10 12
19 21
17 19
15 17
13 15
25 27
23 25
21 23
19 21
17 19
16 17
26 28
24 26
22 24
20 22
28 30
26...

result:

ok good job!

Test #16:

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

input:

442 357
1121121122111122112211222222211112121111122111121122121121112212222222121121111111212122122121222222212122211111211112222221112112122222211122212122222221222211221212211122121221111222112222212122122212212221111121122212221122221111212112211212211222112211122212112211122222112222221221111112...

output:

782
438 440
434 436
431 433
433 435
435 437
437 439
439 441
428 430
430 432
432 434
426 428
428 430
398 400
394 396
396 398
392 393
358 360
360 362
362 364
356 358
358 360
360 361
354 356
356 358
358 360
353 355
355 357
351 353
350 352
352 354
354 356
348 350
350 352
352 354
346 348
348 350
350 352
...

result:

ok good job!

Test #17:

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

input:

499 399
2122122112111122122122111112211112121112121112222111211122112222221221221111212221222211111221221211212211212222112221221212212211121212122122211212212222122122111212111212221121222112111122122111112122211212122221222222211221112212221122122112121212211121121222221121112112111112222211211122...

output:

1316
488 490
490 491
487 489
484 486
483 485
485 487
479 481
481 483
483 484
478 480
477 479
430 432
432 434
428 430
430 432
425 427
427 429
422 424
424 426
426 428
428 430
420 422
422 424
424 426
426 428
419 421
421 423
423 425
425 427
418 420
420 422
422 424
424 425
416 418
418 420
420 422
10 12
7...

result:

ok good job!

Test #18:

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

input:

36 857
212211211121121112122222121222222222
221221122222212222121112211112221221

output:

56
2 3
5 7
9 11
12 14
10 12
8 10
16 18
14 16
12 14
10 12
18 20
16 18
14 16
12 14
11 12
19 21
17 19
15 17
13 15
20 22
18 20
16 18
14 16
12 14
21 23
19 21
17 19
15 17
22 24
20 22
18 20
16 18
24 26
22 24
20 22
18 20
26 28
24 26
22 24
20 22
27 29
25 27
23 25
21 23
19 21
17 19
28 30
26 28
24 26
29 31
27 ...

result:

ok good job!

Test #19:

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

input:

371 54
11122122211122221221111111111112122222112111211111121111111221121212211122121211211112111111121121112122222211121222222211211222211222221222221122211221211211221112222112221121111222122211211211212121112121212111221222221111122222112121112212111121211112222211222222222122212221221221212121212...

output:

1462
333 335
330 332
332 333
326 328
328 330
325 327
327 329
324 326
322 324
321 323
323 325
318 320
320 322
322 323
316 318
318 320
320 322
315 317
317 319
319 321
314 316
316 318
318 319
313 315
315 317
312 314
314 315
311 313
19 21
21 23
23 25
18 20
20 22
22 23
16 18
18 20
15 17
17 19
14 16
16 18...

result:

ok good job!

Test #20:

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

input:

209 349
22122112221111121222122221222211222112221112121122122112221222121121212211211111111212111122222211121221221121211111221212111111112221222222212211222222212212221111212112221222211122212121112122222222211222122
1222112122222212222221222212211212221222121222112122211121111211122222212111221122...

output:

598
9 11
8 9
5 7
1 3
14 16
12 14
16 18
14 16
17 19
15 17
13 15
18 20
16 18
20 22
18 20
21 23
19 21
17 19
22 24
20 22
23 25
21 23
19 21
25 27
23 25
21 23
26 28
24 26
27 29
25 27
23 25
28 30
26 28
31 33
29 31
27 29
25 27
32 34
30 32
28 30
33 35
31 33
29 31
36 38
34 36
32 34
37 39
35 37
38 40
36 38
34 ...

result:

ok good job!

Test #21:

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

input:

157 626
1221122121222222211112121122211122212112122222221211221111212112222221221111121212222212112221222121221111222122121112111121111211121221112212221112212122212
22122221221221211212212212111122112122121211212211222112122211121222222212122212121121221211211221212121122211122111112221221111212121...

output:

91
143 145
118 120
120 121
114 116
116 118
118 120
111 113
113 115
115 117
117 119
109 111
111 113
102 104
104 106
101 103
99 101
97 99
95 97
69 70
67 69
65 67
54 56
56 58
50 52
52 54
54 56
48 50
50 52
47 49
49 51
46 48
45 47
44 45
17 18
1 3
4 6
5 7
7 9
9 11
10 12
8 10
6 8
12 14
10 12
14 16
12 14
20...

result:

ok good job!

Test #22:

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

input:

447 512
1211212211222111221122222111212112111212111121221111122121122111111112121222222211222212111211122121111222221112111211112211121221122122121222221212211222112122221211121211222212112221121221211111111221222111211121121122112211122211212112211121121222121111212112112111111122222122121111211111...

output:

814
413 415
405 407
407 409
409 411
411 413
413 414
404 406
406 408
408 410
410 412
403 405
405 407
407 409
409 411
411 413
402 404
404 406
406 408
408 410
401 403
403 405
405 407
407 409
409 411
393 395
395 397
397 399
399 401
401 403
403 405
405 407
407 409
392 394
394 396
396 398
398 400
400 402
...

result:

ok good job!

Test #23:

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

input:

304 553
2222111221212211222222221121121212121212111121212111212212211121121111121222221222211112111111211122212111112111221121211222221222112211212121222212112221111111212121122221222222211121121121221122121212212211212212122121122121121122111211212211221222221211221221211112212222212111111211211111...

output:

609
300 302
302 304
296 298
298 300
300 302
287 289
289 291
291 293
293 295
295 297
297 299
299 301
301 303
284 286
286 288
288 290
290 292
292 294
294 296
296 298
298 300
277 279
279 281
281 283
283 285
285 287
287 289
289 291
291 293
293 295
295 297
297 299
275 277
277 279
279 281
281 283
283 285
...

result:

ok good job!

Test #24:

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

input:

300 283
1222222212221212221112211121121112112111122122211121112212221222121112211111111112221121111211112122112222211122222221121221112211212112121122122122212221221212122111211221222211122212222122212111122121111221221222122122222111122121111111211222122221221211211111122221212112221211212222211211...

output:

803
297 299
23 25
22 24
24 26
18 20
20 22
22 23
17 19
19 21
16 18
18 19
14 16
16 18
12 14
11 13
13 15
15 17
10 12
7 9
9 11
1 2
2 4
28 30
32 34
30 32
35 37
33 35
31 33
29 31
40 42
38 40
36 38
34 36
41 43
39 41
37 39
35 37
33 35
43 45
41 43
39 41
37 39
44 46
42 44
40 42
38 40
45 47
43 45
41 43
49 51
4...

result:

ok good job!

Test #25:

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

input:

387 146
2211222121111211111222212111121112121122122212112212122212111222212111121211222222111121221221221121112221111122112122211212211222122211122221122211112111211211222211112212222122211122121222212221112122112211122112211112122211122222111221221121122212211221211111211211212211221122212112212212...

output:

450
309 311
305 307
307 309
301 303
303 305
305 307
300 302
302 304
304 306
306 308
308 310
299 301
301 303
303 305
296 298
298 300
300 302
302 304
304 306
295 297
297 299
299 301
294 296
296 298
298 300
300 302
292 294
294 296
296 298
289 291
291 293
293 295
295 297
297 299
287 289
289 291
291 293
...

result:

ok good job!

Test #26:

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

input:

66 369
112112222112111112212111221111122112211221221212111112221112221212
222211122211221212221121111111111212121211122111221221212212121111

output:

74
48 49
1 3
4 6
2 4
5 7
3 5
6 8
4 6
10 12
8 10
16 18
14 16
12 14
10 12
17 19
15 17
13 15
19 21
17 19
15 17
14 15
23 25
21 23
19 21
17 19
16 17
24 26
22 24
20 22
18 20
30 32
28 30
26 28
24 26
22 24
20 22
31 33
29 31
27 29
25 27
23 25
21 23
19 21
34 36
35 37
33 35
31 33
29 31
27 29
25 27
23 25
38 40
...

result:

ok good job!

Test #27:

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

input:

79 896
1212112112112222111112121112111222211112122112221212221111121111111222121211221
1211212212212221111111221121122111111121121121221212111212222211212212111111221

output:

55
60 61
54 56
56 58
58 60
53 55
55 57
57 59
52 54
54 56
56 58
50 52
52 54
54 56
48 50
50 52
46 48
48 50
43 45
42 44
44 46
46 48
40 42
35 37
37 39
4 5
8 10
11 13
12 14
10 12
13 15
14 16
20 22
18 20
16 18
15 16
23 24
26 28
24 26
30 32
28 30
27 28
31 33
32 34
30 32
66 68
64 66
62 64
67 69
65 67
68 70
...

result:

ok good job!

Test #28:

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

input:

231 339
112211112111122222122122111122221111222221221111111121222122112211111221121122121121211221121212221221122111221221212222211221122221122222121111122211121121112111212112211211221211111221211222212122212112122112111211212112111122112
111112211221211112112221211122111222222211222122122112111221...

output:

244
228 230
227 229
222 224
224 226
219 221
221 223
223 225
225 227
217 219
219 221
221 223
214 216
216 218
218 220
210 212
212 214
214 216
216 218
207 209
209 211
211 213
213 215
215 217
217 219
219 221
206 208
208 210
210 212
212 214
214 216
204 206
201 203
203 205
205 207
207 209
209 211
211 213
...

result:

ok good job!

Test #29:

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

input:

109 984
2121221222211211121212122121112211121221221122222122111111112121212122112212111222111111221122111121211122112
1111212122211121112222112221112112121111211211111222112112222112121112222112112111221122121122211222112122212

output:

209
105 107
101 103
103 105
99 101
101 103
94 96
96 98
98 100
93 95
95 97
97 99
90 92
92 94
94 96
96 98
89 91
91 93
93 95
82 84
84 86
86 88
88 90
90 92
92 94
81 83
83 85
85 87
87 89
89 91
91 93
80 82
82 84
84 86
86 88
88 90
76 78
78 80
80 82
82 84
84 86
86 88
74 76
76 78
78 80
80 82
82 84
73 75
75 7...

result:

ok good job!

Test #30:

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

input:

33 61
221112222112212211212221112222221
222112222211222112122121112122221

output:

16
5 7
3 5
7 9
10 12
11 13
9 11
13 15
14 16
17 19
15 17
20 22
18 20
26 28
24 26
22 24
20 22

result:

ok good job!

Test #31:

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

input:

402 243
2211121211221211111221122111221221221112121221211211111221221222211212121111122121111211222222211112112122212211122211122121122212211122222221221121112212122221112222111221122212221111211121222112211122211212111111122221122211122122211122121212122212122112211122111211221222112111112121112212...

output:

570
393 395
395 397
397 399
399 401
391 393
393 395
387 389
389 391
391 393
383 385
382 384
384 386
386 388
381 383
380 382
382 384
384 386
378 380
380 382
382 384
377 379
379 381
376 378
378 380
380 382
371 373
373 375
375 377
377 379
370 372
372 374
374 376
376 378
368 370
370 372
372 374
367 369
...

result:

ok good job!

Test #32:

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

input:

380 225
1122122211112212212122121222211212122222212121112212111221222111121221122112212222212212121122112221122211221211222212211211211212221111211112212112212222111122112211121222222112211122122111112112221211221211112111222221222112112111212121222122212111222122212211112122212111112212112211122222...

output:

774
187 189
189 191
186 188
188 190
184 186
183 185
185 187
187 189
179 181
181 183
183 185
178 180
180 182
182 184
175 177
177 179
179 181
181 183
174 176
176 178
178 180
173 175
175 177
177 179
179 181
172 174
174 176
176 178
171 173
173 175
175 176
170 172
172 174
168 170
170 172
164 166
166 168
...

result:

ok good job!

Test #33:

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

input:

310 958
2222122112221211222222112111112211211221122212211121212221221221212122112221121121222222122121212222121222211211211122212112112122121222222111222212112211212121222112212121121212112212212212121112211111212221222212221112221212212221211122222121221112221222222211121122211212212112212111112122...

output:

690
305 307
307 309
304 306
306 308
308 310
303 305
305 307
300 302
302 304
304 306
298 300
300 302
302 304
297 299
299 301
301 303
303 305
296 298
298 300
300 302
295 297
297 299
299 301
301 303
294 296
296 298
298 300
293 295
295 297
297 299
299 301
291 293
293 295
295 297
297 299
289 291
291 293
...

result:

ok good job!

Test #34:

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

input:

424 565
2121222121112111112211111112121221212221122222221211212112112121122122211222112111222211111122122112111221222211212221211121122212112121112212112121212121121112211111122211122222122212111111112221122122112212222222121112222222211112211212121212221222212121112212212112222111122212211221122111...

output:

1137
13 14
9 11
7 9
9 10
6 8
2 3
17 19
15 17
18 20
16 18
26 28
24 26
22 24
20 22
18 20
28 30
26 28
24 26
22 24
20 22
30 32
28 30
26 28
24 26
22 24
31 33
29 31
27 29
25 27
23 25
21 23
19 21
17 19
33 35
31 33
29 31
27 29
25 27
23 25
21 23
35 37
33 35
31 33
29 31
27 29
25 27
23 25
36 38
34 36
32 34
30 ...

result:

ok good job!

Test #35:

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

input:

348 808
1212221222122212121111111122121211221212111111222122112211121211211112222212211111221222221211211212111221111222122111121122112111221111211112222212111221221121221211111221111122121121211212121211222121111212122112222111222122111212221211111212121222121111122112112211221121111112111221211122...

output:

300
346 348
344 345
342 343
337 339
339 341
335 337
334 335
326 328
325 327
252 254
249 251
242 243
236 238
238 240
240 241
234 236
236 238
238 240
233 235
235 237
237 239
232 234
234 236
236 238
230 232
232 234
234 235
226 228
228 230
230 232
232 234
225 227
227 229
229 231
231 233
223 225
225 227
...

result:

ok good job!

Test #36:

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

input:

72 980
212222212121221212221211122121121122212211112212121222121122121121122212
112212121112211212222112122222122112121122211112221112122212112212122222

output:

75
69 71
65 67
67 69
62 64
64 66
60 62
62 64
59 61
61 63
56 58
58 60
54 56
56 58
53 55
55 57
52 54
54 56
50 52
52 54
48 50
46 48
45 47
47 49
40 42
39 41
41 43
37 39
39 41
36 38
35 36
29 31
31 33
27 29
26 28
28 30
22 24
24 26
26 28
20 22
22 24
24 26
19 21
21 23
23 25
25 27
18 20
20 22
22 24
16 18
18 ...

result:

ok good job!

Test #37:

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

input:

51 563
112111212112122112222111111222121121111121212222112
112111122121211121111212221211121222112212112211212

output:

27
48 49
32 34
34 36
30 32
32 34
29 31
31 32
21 23
23 25
25 26
20 22
22 24
19 21
21 23
23 25
18 20
20 22
15 17
7 8
11 12
13 14
39 41
41 43
40 41
44 46
42 44
46 47

result:

ok good job!

Test #38:

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

input:

194 823
11211122111222111211221111212111222111111212221221221111122221221121111111111111111222112221221122221222211121212122221222212221211121121112122222122222111212112112122212122221221121111211222211
2212211222112211211212122211222212221211121221122111111111111222212122111112221211112111122112212...

output:

383
192 194
191 193
190 191
186 188
181 183
183 184
178 180
180 182
177 179
179 180
174 176
176 178
172 174
174 176
170 172
172 174
167 169
161 163
158 159
152 154
151 153
133 135
135 137
129 131
131 132
127 128
1 3
5 7
6 8
4 6
2 4
10 12
8 10
6 8
4 6
11 13
9 11
12 14
10 12
8 10
16 18
14 16
12 14
10 ...

result:

ok good job!

Test #39:

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

input:

218 200
21211222212221121221212121121121211111212222222212212211221111111111221121221211211111122211112222121122222122222121212111221111221122121112221122211121222122112112122222121221211222222211221112212121122211211121121222
2122111222221111211122221121122212221112211221112122211121212221121222221...

output:

351
211 213
207 209
204 206
206 208
208 210
210 212
203 205
197 198
58 60
60 62
57 59
59 61
61 63
54 56
56 58
58 60
60 61
53 55
55 57
57 59
51 53
53 55
55 57
50 52
52 53
48 50
50 52
47 49
49 51
46 48
48 49
33 34
31 32
28 30
25 27
27 29
29 31
23 25
25 27
21 23
19 21
18 20
20 22
22 24
16 18
18 20
20 2...

result:

ok good job!

Test #40:

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

input:

261 918
121221112112122122111121212112212211111121111212111212221112121112121122121112221111222121111222121221222112111212211212212211212122122112122111112222212222212111122111222222211222112122222112122122121121111121222221121112121222212111211122111211111112122212222
111212211121211222212211211212...

output:

645
244 246
239 241
241 243
235 237
237 239
239 241
231 233
233 235
235 237
237 239
229 231
231 233
233 235
235 237
228 230
230 232
232 234
234 236
236 238
227 229
229 231
226 228
228 230
230 232
224 226
226 228
228 229
222 224
224 226
218 220
220 222
222 224
215 217
217 219
219 221
221 223
223 225
...

result:

ok good job!

Test #41:

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

input:

412 618
1112222122111122221121221122222221121112222212121111111221221222111121122111111122122222112112122121111221121221111221111222121221221121111122111111212122111211221111211211211212211111112222121211222112212121222112121221222122121222211221222112112211222112222121111221212211221122211212222121...

output:

1314
405 407
407 409
402 404
404 406
401 403
403 405
405 407
398 400
400 402
402 404
396 398
395 397
389 391
387 389
389 390
385 387
387 388
383 385
385 386
381 383
380 382
382 384
378 380
376 378
375 377
369 371
371 373
373 375
366 368
368 370
370 372
365 367
367 369
369 371
371 373
364 366
366 368...

result:

ok good job!

Test #42:

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

input:

252 461
211122121121212111111222121212221122112221222222121122211112222221122221122121222121221221111222211112111212111122122212122211111221121111112111122111112212212121111222112121111211122211121221221222211122121112111112112122211111221222111122111111112121
111211122112112121212111211111112221111...

output:

838
251 252
249 251
240 242
242 244
244 246
246 248
248 250
239 241
241 243
234 236
236 238
238 240
240 242
242 244
244 246
246 248
233 235
232 234
234 236
236 238
238 240
240 242
242 244
244 246
230 232
232 234
234 236
236 238
238 240
229 231
223 225
225 227
227 229
222 224
224 226
226 228
228 230
...

result:

ok good job!

Test #43:

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

input:

403 762
1121111121211222121112221221121121112122122211222212211122221221112211212221112212122122122122212211222222212211122121121112122211112222212211112211112122222111112121222211211122111211211112222112211111211111222122222222221112112122111122221211221212211221221112212211121122221221111222212221...

output:

581
400 402
398 400
396 398
395 397
394 396
392 393
390 392
388 390
387 389
389 391
385 387
387 389
380 382
382 383
379 381
377 379
376 377
364 365
360 362
362 364
358 360
360 362
362 363
357 359
359 361
355 357
357 359
354 356
356 358
358 360
351 353
353 355
350 351
348 350
182 183
178 180
177 179
...

result:

ok good job!

Test #44:

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

input:

76 510
2222111212221211121221222112212211112211122222112221211122211121122212122122
2122112112212212121222212122121222221221211211121212211122121221222211122111

output:

56
14 16
12 14
11 13
10 11
8 10
3 5
5 7
2 3
22 24
27 29
30 31
35 37
33 35
36 38
34 36
40 42
38 40
36 38
41 43
39 41
37 39
35 37
42 44
40 42
38 40
43 45
41 43
39 41
44 46
47 49
45 47
43 45
41 43
48 50
50 51
52 53
55 57
53 55
57 59
64 66
62 64
60 62
65 67
66 68
64 66
62 64
68 70
66 68
70 72
68 70
71 7...

result:

ok good job!

Test #45:

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

input:

336 811
2211111222112221111221212112121111111221121221112122121221212111211122222221222221222221222111121222212121221122222212212122121212122221112222222221121211111212222122122112112121112112211212212122211212222111212212211211222122212222212211221211221212112111122221212111221112111121111122222122...

output:

896
147 149
146 148
145 146
15 17
17 18
14 16
10 12
9 11
2 4
1 2
6 8
19 20
22 23
23 25
26 28
36 38
34 36
32 34
37 39
35 37
33 35
31 33
29 31
27 29
40 42
38 40
36 38
34 36
42 44
40 42
38 40
36 38
43 45
41 43
39 41
37 39
35 37
33 35
31 33
29 31
47 49
45 47
43 45
41 43
39 41
37 39
35 37
33 35
49 51
47 ...

result:

ok good job!

Test #46:

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

input:

363 525
1121111112211122212122112212112111112212221221121112111112212212212221121121122212221111111111212112212122211122211222111121122122122121112222111121121111111211212211112221121112112112111211222112112122112212221212212221112222122211221221112212111222212222111122222221222122221212112111212121...

output:

532
331 333
330 332
299 301
301 302
298 300
297 299
299 301
291 293
293 295
295 296
289 291
291 293
287 289
289 291
291 292
283 285
280 282
282 284
278 280
280 282
282 283
276 278
278 279
275 277
1 3
8 10
6 8
9 11
7 9
5 7
3 5
13 15
11 13
9 11
7 9
5 7
14 16
12 14
10 12
15 17
17 19
19 21
20 22
18 20
1...

result:

ok good job!

Test #47:

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

input:

134 452
22111112221112112112222121221222212222212221112222112212122221222121112212112221122212212121121122221212111211111221221221122122121112
21221111122111211222122122222221222221111122211222112122122122122122112112211121122212211221211112212121122222212211121212221122221112

output:

105
127 129
125 127
121 123
120 122
118 120
117 118
108 110
110 111
104 106
106 108
108 110
102 104
104 106
106 108
108 109
100 102
102 104
104 106
106 108
99 101
101 103
103 105
105 107
98 100
100 102
102 104
104 106
97 99
99 101
101 103
94 96
96 98
91 93
93 95
95 97
97 99
99 101
89 91
91 93
93 95
...

result:

ok good job!

Test #48:

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

input:

134 865
22212222211222112122112221122122221111121221112211122121112211222212121222222122222112212122212122111121221221121222112212212212112222
22122112121212112121121112222222122212112221221222122222111111221211122212122121222212221221222222212112112222122211211112221112121222

output:

126
92 94
89 90
87 88
83 85
85 87
82 84
81 83
80 82
79 81
77 79
75 77
43 45
42 43
40 42
34 36
36 38
33 35
35 37
37 39
39 41
32 34
34 36
31 33
33 35
29 31
31 33
33 34
28 30
30 32
25 27
27 29
29 31
24 26
26 28
28 30
23 25
25 27
27 29
20 22
22 24
24 26
26 28
19 21
21 23
23 25
25 27
17 19
19 21
21 23
23...

result:

ok good job!

Test #49:

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

input:

274 107
2212222112221112121222212212122212121112121212122111221221221111211211222211211211111122112222112112122122222211222111211222212221121122112211121211112221221121221111212222121211122111222212221222211112122222111212211111112121112222222221212222112222211122211222121111121122
22122212111121221...

output:

682
49 51
48 50
50 52
46 48
48 50
44 46
46 48
48 49
42 44
44 46
46 48
40 42
42 44
44 46
36 38
38 40
40 42
42 44
44 45
34 36
36 38
38 40
40 42
42 43
32 34
34 36
36 38
31 33
33 35
35 37
30 32
32 34
34 35
28 30
30 32
32 33
26 28
28 30
30 32
25 27
27 29
29 31
23 25
25 27
27 29
22 24
24 26
21 23
23 25
20...

result:

ok good job!

Test #50:

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

input:

414 808
2121221211222112211122122222211112211121122211221122212121222222222222212111121212122112111112121111222222111212122122122222211211112121221221111211121112221112121112122212112222212212122221222222121211112122212212211111222212112112112111221221222121222112112211222121222121122122111121211212...

output:

971
359 360
340 342
338 340
330 332
326 328
325 327
327 329
329 331
318 320
320 322
322 324
324 325
316 318
318 320
320 322
314 316
316 318
318 320
313 315
315 317
317 319
319 321
321 323
311 313
313 315
315 317
317 319
310 312
312 314
314 316
316 318
308 310
310 312
306 308
305 307
307 309
309 311
...

result:

ok good job!

Test #51:

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

input:

482 170
1121222222122111121212122122122212121122112211212221211221221222211221211212112222122121121212211111111221112221122112111222212221211112221122222121122222121211121111121221121121112111112222112221122212111211122212111111221112221112121211212112122111121221112121212221122221211222222211111211...

output:

978
481 482
475 477
474 475
2 3
3 5
4 6
5 7
6 8
7 9
8 10
10 12
11 13
16 18
14 16
12 14
18 20
16 18
14 16
13 14
20 22
18 20
16 18
14 16
22 24
20 22
18 20
16 18
23 25
21 23
19 21
17 19
15 17
25 27
23 25
21 23
19 21
17 19
26 28
24 26
22 24
20 22
18 20
28 30
29 31
27 29
25 27
23 25
21 23
30 32
37 39
35 ...

result:

ok good job!

Test #52:

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

input:

117 25
112212222221112122221111222222122211212111122122111121122211121211121222122221122111111211222122221221211121222111222
111122222122122111222212111122112222211121122212122212212211111121112222122212112121211222111112221211112112221222222

output:

78
111 113
113 114
110 112
109 111
111 113
107 109
109 110
103 105
105 107
107 109
101 103
103 105
100 102
102 104
104 106
106 108
98 100
97 98
95 97
81 83
80 81
77 78
68 69
64 65
48 50
47 49
49 51
44 46
46 48
39 41
34 36
36 38
38 40
40 42
42 44
44 46
33 35
32 34
34 36
36 38
38 40
40 42
42 44
30 32
...

result:

ok good job!

Test #53:

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

input:

344 865
1111222222222122212121112221111122221122111221111112222122112112111211221222222221211111121121211222121122112222121112212222212221111121122221222111211112212111121222211111121111221122121122112112212221122221222121222121222221212221221122211111111211121112121212212112112222122121111122212212...

output:

505
339 340
334 336
336 338
333 335
335 336
331 333
333 335
330 332
328 330
327 328
323 324
303 305
305 307
298 300
300 302
302 304
304 305
296 298
298 300
300 302
295 297
297 299
299 301
301 303
294 296
292 294
289 291
291 293
293 295
295 297
297 299
299 301
287 289
289 291
291 293
293 295
295 297
...

result:

ok good job!

Test #54:

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

input:

416 266
1122121211112212122212111111222122221212211112211122211222222112212211121221121212112211211111222222211212111222121112111112211212111221212112222122112222211112122121111111211111211121212111212111121121212121221122222221222222121221212221111212121212212212212212211121121222211111112112121122...

output:

837
401 402
399 400
397 399
394 396
396 398
391 393
393 395
395 397
389 391
388 390
390 392
392 394
394 396
387 389
383 385
385 387
382 384
384 386
386 388
377 379
379 381
381 383
383 385
374 376
376 378
378 380
380 382
369 371
371 373
373 375
375 377
377 379
379 381
367 369
369 371
371 373
373 375
...

result:

ok good job!

Test #55:

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

input:

122 942
11212212222212221121121211211221222121122222221111121111122222222122212111221222112112111112112221121211221111221212221221
11122212121221112122222112111122211222121111111222222222122111211222121212211121221221121112212222221212112111221212212211

output:

120
96 98
92 94
94 96
86 88
88 90
90 92
83 85
85 87
87 89
89 91
91 93
80 82
82 84
84 86
86 88
79 81
81 83
83 85
78 80
80 82
82 84
76 78
78 80
80 82
75 77
77 79
79 81
71 73
73 75
75 77
77 79
69 71
71 73
73 75
68 70
70 72
72 74
67 69
69 71
71 72
65 67
67 69
69 70
64 66
66 68
63 65
65 67
62 64
64 66
61...

result:

ok good job!

Test #56:

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

input:

45 417
111112112221111122222222221212211212112122121
212122222212121122211111211211121221122121122

output:

55
44 45
42 44
36 38
31 33
33 35
30 32
4 6
2 4
1 2
7 9
5 7
3 5
8 10
6 8
9 11
7 9
5 7
15 17
13 15
11 13
9 11
7 9
16 18
14 16
12 14
10 12
8 10
17 19
15 17
13 15
11 13
9 11
18 20
16 18
14 16
12 14
10 12
19 21
17 19
20 22
18 20
16 18
14 16
12 14
21 23
19 21
22 24
20 22
18 20
16 18
14 16
24 26
22 24
20 2...

result:

ok good job!

Test #57:

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

input:

440 881
1111221112211221121112222212222122221122112221212122121122212221111221221221222212121112112121112221122112112212212211212121122112112112121211221112112221111121121111112112121222212112222112222122221121212112222211111212211222221221111221112221212212122112111212112211211211221112211121222222...

output:

625
438 440
435 437
437 439
429 431
431 433
433 435
435 437
427 429
429 431
431 433
426 428
428 430
430 432
432 434
418 420
420 422
422 424
424 426
416 418
418 420
420 422
415 417
417 419
419 421
421 423
423 425
425 427
413 415
415 417
417 419
419 421
421 423
411 413
413 415
415 417
417 419
419 421
...

result:

ok good job!

Test #58:

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

input:

284 884
21111212121111112111222121122122212122111222212122212211221121211111212211121222112222122212122121211112121122222122222211111112111122212222122221111121221212222221221212221111212211111121111211111222112221212121122112211211111222211122221121121222111212211111122221111121111122211211
1112122...

output:

794
282 284
279 280
277 279
271 273
273 275
265 267
267 269
269 271
271 273
264 266
266 268
268 270
270 272
272 274
274 276
263 265
265 267
267 269
262 264
264 266
266 268
268 270
270 272
272 274
255 257
257 259
259 261
261 263
263 265
265 267
254 256
256 258
258 260
260 262
262 264
264 266
266 268
...

result:

ok good job!

Test #59:

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

input:

422 324
1122222121221221121221212122111112212121211222221221212112222221112112212211111221112221222212122122211121121111211111221222122221122121122221122221221221122122222212222121111121211212222121222222111112212111112221221112111111121122111221121222222112211211222212222121122112221121111112112212...

output:

888
420 422
418 420
413 415
415 417
417 419
411 413
413 415
410 412
412 414
414 416
416 418
409 411
408 410
410 412
412 414
414 416
403 405
405 407
407 409
402 404
401 403
403 405
400 402
402 403
399 401
398 400
397 399
396 398
380 382
382 384
384 386
386 388
388 390
390 392
392 394
379 381
381 383
...

result:

ok good job!

Test #60:

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

input:

247 857
1112211211222111211122112111221222122212221111212121121212221211112122222111221211121121121122221211112221221122121212222122122111212112121211221112112111211222211221122221112222222111122112221122111111121111111211112122112121122211212212121122221
22111112221122221222211122212211112111221111...

output:

583
246 247
240 241
233 234
229 231
225 227
227 229
223 225
225 227
220 222
219 221
221 223
223 225
217 219
219 221
204 206
206 208
208 210
196 198
198 200
200 202
202 204
204 206
206 208
195 197
197 199
199 201
201 203
203 205
205 207
207 209
209 211
211 213
213 215
215 217
217 219
192 194
194 196
...

result:

ok good job!

Test #61:

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

input:

272 376
22221122111211111222211222221222212122221221111222212222222122211212112222111121222211222221222212121221112122211211221221112111111212121212211122222122222221222222211112121221212211221122222111222221111121211221112221211112122221222121211211211212111121222122111111122111
2222211111111222212...

output:

586
269 271
271 272
260 262
262 264
259 261
261 262
257 259
256 258
255 257
253 255
248 250
250 252
252 254
254 256
246 248
248 250
250 252
252 254
243 245
245 247
247 249
249 251
251 253
240 242
242 244
244 246
246 248
248 250
250 252
237 239
239 241
241 243
243 245
245 247
247 249
249 251
235 237
...

result:

ok good job!

Test #62:

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

input:

456 295
1221111112111221222222121212221222112212111112212221212122122122122211211211122122222212221211122222212211111212121111122222112212121211221121212221122112111221211122121121212121212112122112221122211212111221221211221122211111221211221112221122111112111121222121112112112221222221211122221112...

output:

952
161 163
163 164
159 161
158 160
154 156
151 153
153 155
155 157
150 152
152 154
154 155
147 149
149 151
151 153
146 148
145 147
143 145
145 146
141 143
138 140
140 142
142 144
137 139
139 141
134 136
136 138
138 140
132 134
127 129
129 131
131 133
123 125
125 127
127 129
121 123
123 125
125 127
...

result:

ok good job!

Test #63:

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

input:

463 947
1111221121222222122211112221111122122112211211211211222221121112121121122222211121121122221212212122112121212112111112112222211222121121121111111211121121111111112222112121221121122112111211222221122221222112111221212122221211221111221211222121221111221111222111212122111111121212222111112221...

output:

1304
57 59
59 61
56 58
55 57
57 59
53 55
50 52
47 49
49 51
44 46
46 47
27 29
26 28
20 22
22 24
19 21
21 23
18 20
20 21
16 18
18 20
15 17
17 19
14 15
3 5
4 6
7 9
5 7
9 11
8 9
10 12
31 33
33 34
34 36
35 37
38 40
62 64
64 66
67 69
65 67
70 72
68 70
72 74
82 84
80 82
78 80
85 87
83 85
86 88
87 89
85 87
...

result:

ok good job!

Test #64:

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

input:

242 384
11212222111222212221111221121211122111212121221121112222122212112222212112112222221112211222112221211221112112212121212122121212211211222212111111221221211211122212122211112212112222221221212112111212222222212121212122211111121121222222112211
2111112111211212221221112211112212112211212221222...

output:

222
240 242
219 221
221 223
218 220
220 222
222 224
217 219
215 217
217 218
213 215
215 217
211 213
213 215
215 216
209 211
211 213
213 215
207 209
209 211
211 213
206 208
208 210
210 212
212 214
205 207
207 209
209 211
204 206
206 208
208 210
203 205
205 207
207 209
202 204
204 206
206 208
201 203
...

result:

ok good job!

Test #65:

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

input:

256 235
2122221122211122222211121122211121221212112122111121221212121122221112222111121122121221222122122221121111122221222221212112121112122121212222222111111222121111222121212212112221222122121221121111121211122222122121222111111122121112212221122211122122122221
21111112221121221112112212111122221...

output:

391
254 256
252 254
250 252
249 251
247 249
246 248
248 250
242 244
244 246
246 248
241 243
243 245
245 247
240 242
242 244
244 246
237 239
239 241
241 243
236 238
238 240
240 242
242 244
235 237
237 239
239 241
233 235
235 237
232 234
234 236
236 238
238 240
240 242
228 230
230 232
232 234
234 236
...

result:

ok good job!

Test #66:

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

input:

464 855
1112211221222222211221211111121111222222121212122122212211221211221222122222111121122111221221111112212111112122221122222212212212222212221211122211121121122221222112121112212212222121222221112211221212211121121221212121222212211212121122212212121111111222111211222222221112212111212122222112...

output:

1327
456 458
455 457
452 454
454 456
448 450
450 452
452 454
447 449
449 451
451 453
453 455
446 448
448 450
450 452
444 446
443 445
445 447
447 449
449 451
441 443
443 445
440 442
439 441
441 443
438 439
435 437
432 434
434 436
430 432
432 434
429 431
427 429
426 428
428 430
430 432
425 427
423 425...

result:

ok good job!

Test #67:

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

input:

321 947
1211121122121112121121212222111212112211121222222212221222121121111122212122221222121111211122112221111122221121122221122122121122212221122121222211112111112212112211221111211111211222212212112222221111221111122211121212212212112211121121221221122222222112112111112221212211211211122211211112...

output:

392
295 296
292 294
287 289
289 291
291 293
284 286
286 288
283 285
285 287
287 289
289 291
282 284
278 280
280 282
275 277
277 279
279 281
281 283
283 285
272 274
274 276
271 273
273 275
275 277
277 279
279 281
281 283
269 271
271 273
273 275
275 277
267 269
269 271
271 273
273 275
266 268
268 270
...

result:

ok good job!

Test #68:

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

input:

268 726
1111222212222222121122221211122121122221112222222121212122211211212121221221112122121222111221222112111212122121212121221111122122111222122212112121121121112221111212212221122212112111221122221222112221121212221211221111112111112121222212122112112222122212212121212212
11112112111221211121221...

output:

497
216 218
215 217
217 219
212 214
214 215
210 212
212 214
209 211
208 210
210 212
206 208
204 206
206 207
195 197
194 195
192 194
190 192
186 188
188 190
181 183
178 180
180 182
182 184
176 178
178 180
180 182
175 177
177 179
179 180
174 176
171 173
173 175
175 177
170 172
169 171
171 173
167 169
...

result:

ok good job!

Test #69:

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

input:

159 708
112122221111122221211112111122111111121111222212111112111122112222112211111112111112221211111212122111221121222111111222211122122122222111211212222122111121112
111122211211121211121211111111122211112112122222212212211111211212111122121212212112122211212221111211221122111211122222112222111212...

output:

235
70 72
69 71
45 47
47 49
43 45
45 47
38 40
40 42
30 32
32 34
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
24 26
26 28
28 30
30 32
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
16 18
18 20
20 22
15 17
17 19
19 20
14 16
8 10
10 12
12 ...

result:

ok good job!

Test #70:

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

input:

252 78
221121122112221221111121211112121221121212221211212111111111112212122111111212212112212221122111122212222211212122211111111211112111111121122121211121211212122212121212211222122212211111121122111112212211112122112222121112221221112222112111221212222112
1221122222111112121112211111121222111221...

output:

580
249 250
247 249
51 53
53 55
49 51
51 53
46 48
48 49
44 46
46 47
40 41
35 37
37 39
25 27
27 29
29 31
31 33
17 19
19 21
21 22
16 18
14 16
5 6
1 3
7 9
10 12
11 13
9 11
61 63
59 61
57 59
62 64
60 62
64 66
62 64
66 68
64 66
67 69
65 67
63 65
61 63
59 61
74 76
72 74
70 72
68 70
66 68
76 78
74 76
72 74...

result:

ok good job!

Test #71:

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

input:

188 305
12222121122111121122222211222211221212112122212112112212112221212122222111122111121111111111221111122112122212211122222112112221111211211221112111122111111221212221212212112112112222122222
2122112122111211221122221211212211121212112122211111112121222212121211121222222211212111111222112112212...

output:

194
127 129
129 131
122 123
119 120
110 112
108 110
107 108
82 84
84 86
86 88
88 90
90 92
77 79
79 81
81 83
83 85
76 78
78 80
71 73
73 75
75 77
77 79
79 81
81 83
70 72
72 74
74 76
76 78
69 71
71 73
73 75
75 77
77 79
68 70
70 72
72 74
74 76
67 69
69 71
71 73
73 75
75 77
65 67
67 69
69 71
71 73
73 75
...

result:

ok good job!

Test #72:

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

input:

451 381
2122121211221222121122122211122222122222221212222112211121211212221211222212112222121212112122222211212211212121222221121211212211121121211222211112122221122221212121222212211221211112222121122111211212111121111221112222122221121111222121212211121121122222111122112111211212122121212221221222...

output:

849
430 431
425 427
423 425
421 423
420 422
422 424
424 426
418 420
420 422
422 424
415 417
417 419
419 421
412 414
414 416
416 418
411 413
413 415
415 417
417 419
410 412
412 414
407 409
409 411
411 413
413 415
415 417
406 408
408 410
410 412
404 406
406 408
403 405
405 407
407 409
409 411
330 332
...

result:

ok good job!

Test #73:

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

input:

239 584
22211122211121121212121122121112121121222121222212111211212211212111112211222221122122212221221222212221212112221221122221212222122221111122122121122212221112221122121221122121221111121212221212221111221221111222221211212221111212222222221
2221212221212211222111212222121221121111122211212121...

output:

333
178 180
177 179
179 181
181 183
175 177
177 179
173 175
175 177
172 174
174 176
176 178
168 170
170 172
172 174
174 176
166 168
168 170
164 166
163 165
165 167
160 162
162 164
159 161
161 163
163 165
158 160
160 162
154 156
156 158
158 160
160 161
153 155
155 157
157 159
152 154
154 156
156 158
...

result:

ok good job!

Test #74:

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

input:

331 115
1212121111112121121121121211112211211111111111221212111122211222222111212222112122212211222221121221111221122111121212212211112211112121221122211222222222212121212111122112112111112121121222122111221221122112122211221211221122211212121121221121122212112212211111222221221122112222212111122122...

output:

1090
2 3
11 13
9 11
7 9
5 7
13 15
11 13
9 11
16 18
14 16
12 14
19 21
17 19
15 17
13 15
22 24
20 22
18 20
16 18
14 16
24 26
22 24
20 22
18 20
16 18
29 31
27 29
25 27
23 25
30 32
28 30
26 28
24 26
22 24
33 35
31 33
29 31
27 29
25 27
45 47
43 45
41 43
39 41
37 39
35 37
33 35
31 33
29 31
27 29
46 48
44 ...

result:

ok good job!

Test #75:

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

input:

484 949
2222111221121222111212122122222111112222221112111111211122211221112222212122111221121221222112212122211222212222121222221121222122122221121111111221112112111111211212112122212212211212122111212122111212111221112112121212121212211211122112112121211211121221111122211121212211212211222111212222...

output:

1354
483 484
154 156
156 158
151 153
153 155
155 157
157 159
147 149
149 151
151 153
153 155
155 157
146 148
148 150
150 152
152 154
154 155
138 140
140 142
142 144
144 146
146 148
148 150
150 152
135 137
137 139
139 141
141 143
143 145
145 147
147 149
149 151
134 136
136 138
138 140
140 142
142 144...

result:

ok good job!

Test #76:

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

input:

463 392
2222111122111122222112221221121122222222211221111122111222111211211221112221212211122122121221212211222121111221212222112221222112221212211122222122221112211211112111122111121222122211222221221222212212111111222112221222212122121212222222112112122112122211221221211222211121111122121122212122...

output:

1152
453 455
455 457
452 454
454 456
456 458
458 460
451 453
453 455
450 452
452 454
449 451
451 453
448 450
450 452
446 448
448 450
444 446
446 448
448 449
440 442
442 444
444 446
446 448
436 438
438 440
440 442
442 444
444 446
446 447
435 437
437 439
439 441
441 443
443 445
433 435
435 437
437 439...

result:

ok good job!

Test #77:

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

input:

170 178
11111222222112212112122221111222221221121221221211221211112111112221212111221111121121222212212112212111121211211112212221221111221122221122111111211211222221211111112211
1212212221212211211221111111121122212211111121212121121221221121221112122212111112112222112221121112121212221111211121112...

output:

294
168 170
167 169
159 161
161 163
163 165
165 167
167 168
157 159
159 161
161 163
163 165
165 167
156 158
158 160
160 162
162 164
164 166
155 157
157 159
159 161
161 162
154 156
156 158
158 160
153 155
155 156
150 152
152 154
147 149
149 151
151 152
140 142
142 144
144 146
146 148
139 141
141 143
...

result:

ok good job!

Test #78:

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

input:

52 833
1122211111222221122222221221122212212122221211121122
1221122111221212122111212122112222221122222121212222

output:

50
48 50
44 46
46 48
48 49
42 44
44 46
46 47
41 43
43 45
40 42
39 41
41 43
37 39
39 41
35 37
37 39
34 36
36 38
38 40
32 34
34 36
31 33
33 35
30 32
32 34
27 29
29 31
31 33
26 28
28 30
30 32
24 26
26 28
23 25
25 27
27 29
29 31
22 24
24 26
26 27
21 23
23 25
20 22
22 23
15 16
5 6
2 4
9 11
7 9
11 13

result:

ok good job!

Test #79:

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

input:

289 337
2212212212211212221122222221211112121121212121221121222112212121121222122122121112212222212121221212121222111112222111211111121112222211111121212221222211221212111121111221121211112121122222121212211212121112111112212221211212112211112111122222221121111111112212212211222221211221122112111
22...

output:

714
283 285
285 287
287 289
282 284
279 281
281 283
283 285
278 280
280 282
282 283
275 277
277 279
197 199
199 201
196 198
194 196
196 197
192 194
194 196
190 192
189 191
191 193
188 189
176 178
171 173
173 175
175 177
177 179
165 167
167 169
169 171
171 173
173 175
160 162
162 164
164 166
166 168
...

result:

ok good job!

Test #80:

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

input:

275 642
22211221221111122222212111222212222111212212211221211111121221112222211211211112122212211121112121212212121112222112122122121112121222211221122212212222211211111221212212122212112122112222222212111211121121211112111121121212122211111121122212222211211122211112211111122111221
2112111111222121...

output:

628
274 275
261 263
263 265
265 267
255 257
257 259
249 251
246 248
248 250
245 247
247 249
244 246
243 245
245 247
242 244
240 242
239 241
241 243
243 245
238 240
235 237
237 239
228 230
230 232
232 234
234 236
236 238
227 229
229 231
231 233
233 235
235 237
226 228
228 230
230 232
232 234
234 236
...

result:

ok good job!

Test #81:

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

input:

274 934
1112211122121111121221212211111121111211221222212222121222112121212211212111222221121211111221112122221212222212212112222121122221121212212122121112211212111221221112112221222122121212111112221211212122212221122222111111112121211121211212122212221111111121111221212221121221
22221212122111111...

output:

457
260 262
262 264
255 257
257 259
246 248
248 250
250 252
252 254
254 256
245 247
247 249
249 251
251 253
253 255
255 257
244 246
246 248
248 250
250 252
242 244
244 246
246 248
248 250
241 243
243 245
245 247
247 249
249 251
251 253
253 255
240 242
242 244
244 246
246 248
238 240
240 242
242 244
...

result:

ok good job!

Test #82:

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

input:

230 182
21112111222221222221121121121111212221112112111122212222212111121221211222222212121122112211212211211122221221111111221121222221122112221111111212211121111122121111121212122122211111222211221111222122222222111221112112211221111122
1212122111122212122221212221211212112222122222122211111112211...

output:

286
223 225
151 153
153 154
147 149
146 148
148 150
150 152
144 146
146 147
136 138
138 140
140 142
142 144
144 145
135 137
137 139
139 141
141 143
134 136
136 138
138 140
140 142
131 133
133 135
135 137
137 139
130 132
132 134
134 136
136 138
127 129
129 131
126 128
128 130
130 132
125 127
127 129
...

result:

ok good job!

Test #83:

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

input:

317 182
2122212211212111112112122222122121121111222211222112122222112112111111121112112111211211222112212111112221112122222222211211121121212121122211211121122211121111212211212222121111212122112122122221112112122122221211121111122112212212122221111222121112212211221121221122211122122212112212211111...

output:

1194
58 60
60 62
57 59
55 57
49 50
13 14
8 9
4 6
1 2
10 11
20 22
18 20
16 18
22 24
20 22
18 20
23 25
21 23
24 26
22 24
25 27
23 25
27 28
28 30
29 31
31 33
34 36
32 34
39 41
37 39
35 37
33 35
40 42
38 40
36 38
41 43
39 41
38 39
42 44
40 42
45 47
43 45
51 52
53 54
70 72
68 70
74 76
72 74
70 72
77 79
7...

result:

ok good job!

Test #84:

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

input:

348 517
2221222112221121121122221221111221121112221121121122121112122111121112112111122222221122221111211121221112211112112222222122211211122212112212111211121222121121121121112212122111212122122221221222211122111221212111212111212211222222111111212221211122221121222111211112111111221222122121211112...

output:

743
344 345
341 342
330 332
329 331
331 333
324 326
322 324
319 321
321 323
323 325
317 319
319 321
321 323
316 318
318 320
320 322
315 317
317 319
319 321
313 315
315 317
312 314
314 316
316 318
318 320
311 313
313 315
309 311
311 313
308 310
310 312
312 314
314 316
316 318
307 309
309 311
303 305
...

result:

ok good job!

Test #85:

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

input:

90 971
111221112211121212221112212221121221122112111221111221121112212221222121121121111221221122
122221212112211122111222111121111221222111112122122112111122121122111112212211121212212222

output:

64
86 88
85 87
83 85
82 84
77 79
79 81
81 82
74 76
76 78
78 80
71 73
73 75
75 76
69 71
71 73
73 75
68 70
70 72
67 69
69 71
71 73
64 66
46 48
42 44
44 45
35 37
34 35
32 34
2 4
3 5
7 9
5 7
8 10
6 8
4 6
12 14
10 12
8 10
7 8
14 16
12 14
10 12
9 10
16 18
14 16
12 14
17 19
15 17
13 15
18 20
22 24
23 25
21...

result:

ok good job!

Test #86:

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

input:

438 523
1112121212111122111121111122112111212111221211221121112122211121221211111222222222221111222122221112122111122121111221111221121112211221222221121211222121222122222121211122212212221211122111222122111222221222112221212212121112122222112221122211111121121221122111222121121111221212212121111211...

output:

1409
424 425
416 418
418 420
420 422
412 414
409 411
411 413
413 415
408 410
410 412
406 408
408 410
397 399
399 401
401 403
403 405
405 407
407 409
409 411
411 413
395 397
397 399
399 401
401 403
403 405
405 407
407 409
409 411
391 393
393 395
395 397
397 399
399 401
401 403
403 405
405 407
389 391...

result:

ok good job!

Test #87:

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

input:

81 478
112121122122121122121111111112212222211112211212212111122111211111112121212212121
122221121212121221112111212112111121111212121112112221121111211222121212122111211

output:

64
61 63
63 65
57 59
59 61
61 63
63 64
51 53
53 55
55 57
57 59
59 61
49 51
51 53
48 50
50 52
46 48
43 45
45 47
47 49
49 51
42 44
37 39
39 41
41 42
36 38
38 40
2 3
3 5
6 8
4 6
7 9
5 7
9 11
8 9
10 12
12 14
16 18
14 16
18 20
16 18
28 30
26 28
24 26
22 24
21 22
29 31
27 29
25 27
31 33
29 31
27 29
32 34
...

result:

ok good job!

Test #88:

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

input:

153 157
212111222111222211212221112211211122112111221111111121122211211111222211122122121111221122122121112121122221122121111111211221122121222221121222111222222
122122111122122121211111222211111122211212221211211221121111212222221121221212122221122222112111112212111212112211122112111122211122221111...

output:

263
39 41
41 42
36 38
38 40
35 37
31 33
33 35
35 36
27 29
29 31
31 33
33 35
23 25
25 27
22 24
24 26
21 23
23 25
16 17
9 11
1 2
5 7
6 8
12 13
51 53
49 51
54 56
52 54
50 52
48 50
46 48
55 57
53 55
56 58
54 56
52 54
65 67
63 65
66 68
64 66
62 64
60 62
58 60
56 58
67 69
65 67
68 70
66 68
64 66
72 74
70 ...

result:

ok good job!

Test #89:

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

input:

453 434
2212221211121122211222111221212222221112122122221112112121112111122121121122222221121222112122112122212221222121112121212222122112121122122222211211111111111112111122112212221221211111212112222221122212222211221211121222112212112211112112112211121121122212222112212211122121222112111221211111...

output:

789
442 444
439 441
441 443
443 445
434 436
436 438
438 440
431 433
433 435
435 437
437 439
439 441
441 443
428 430
430 432
432 434
434 436
436 438
426 428
428 430
430 432
432 434
434 436
425 427
427 429
429 431
431 433
433 435
435 437
437 439
439 441
423 425
425 427
427 429
429 431
431 433
433 435
...

result:

ok good job!

Test #90:

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

input:

496 670
1211121111122111221111221111212212121212221122222212222121212121121121212111221112111112211112221211112121222122211221212222221212121122212222221112111221222222111112121222221111122222112221212212212112222221121211212112212122212222212121121221111222221121221111211111222211111221211212222122...

output:

1102
484 486
483 485
485 487
477 479
479 481
481 483
483 485
476 478
478 480
470 472
472 474
474 476
476 478
469 471
471 473
473 475
475 477
477 479
479 481
467 469
469 471
471 473
473 475
466 468
468 470
464 466
466 468
463 465
465 467
467 469
469 471
471 473
457 459
459 461
461 463
463 465
456 458...

result:

ok good job!

Test #91:

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

input:

10 526
2221221221
2122221221

output:

1
2 4

result:

ok good job!

Test #92:

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

input:

180 555
221221211211221121121212212222211121122111122212112211122211222212211211221122221112212111212221121211212211122211121121122222111221121122221222211111121222212112222112112121121211
122111122212221122212221111111221112222122111222221121222211211112111211222122221121221112121112111222112222212...

output:

149
178 180
176 178
178 179
168 170
170 172
172 174
165 167
167 169
164 166
166 168
163 165
165 167
162 164
164 166
159 161
161 163
163 165
157 159
159 161
161 163
163 164
156 158
158 160
160 162
155 157
157 159
154 156
156 158
158 160
152 154
154 156
156 158
145 147
147 149
149 151
144 146
146 148
...

result:

ok good job!

Test #93:

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

input:

489 819
2111111211211211121222211221221122121211111212121121111112112122121122222111212112212222212122211211112111121211221121121112212111211121212222121222111111112211112121121212122121212221211111121122212121112111222112211222122211221212121112211122121212112212112221121112112212211121222121221211...

output:

1457
477 479
475 477
474 476
476 478
470 472
472 474
466 468
468 470
460 462
462 464
464 466
466 468
455 457
457 459
459 461
461 463
463 465
465 467
467 469
469 471
453 455
455 457
457 459
459 461
461 463
463 465
465 467
467 469
452 454
454 456
456 458
458 460
460 462
462 464
464 466
451 453
453 455...

result:

ok good job!

Test #94:

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

input:

167 414
22222122212212121111122212211121121122211212121222112112221211221212222222212112121222222111211222121112112221111122212112111121212222222221122122122111112111222221121
2211211222111221212122222211122212211111221121111221222212221112122111222121121112222121221222122211121211122222221122212211...

output:

178
163 165
165 167
162 164
161 163
160 162
159 161
155 157
157 159
159 160
149 151
151 153
153 155
148 150
150 152
152 154
154 156
156 158
146 148
148 150
150 152
145 147
147 149
149 151
151 153
143 145
145 147
147 149
149 151
139 141
141 143
143 145
145 147
147 149
138 140
137 139
139 141
141 143
...

result:

ok good job!

Test #95:

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

input:

374 365
1222211122112221112112222212212111221111221111121212212221111122111222212211121111221211222111112121111221212212211122212212212211212211211111112111121121121122111212221121122121222222221211111222111112211121211122221111122112211211212221121122221112121121122112221111212111211111221111111112...

output:

595
188 189
137 138
134 136
133 135
135 137
131 133
133 134
128 130
127 129
129 131
125 126
110 111
91 93
93 94
90 92
86 88
63 65
57 59
59 61
56 58
58 60
60 62
55 57
57 59
53 55
52 54
54 56
56 58
50 52
52 53
48 50
50 51
42 44
44 46
41 43
43 45
45 47
47 49
36 38
38 40
40 42
42 44
35 37
37 39
31 33
33...

result:

ok good job!

Test #96:

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

input:

469 834
1222211111122121211211122121221112112211121212211121112221111112122222111211111112222122111122222221222112121112212212121121121221122212122221121222121212221211122111122121212222112112222111221222212122211121221221222211222122112112211122122221222221112222122112211212122111112112212111221212...

output:

1007
464 466
462 463
417 419
415 417
417 418
413 415
415 417
407 409
406 408
408 410
403 405
405 407
402 404
404 406
406 408
400 402
402 404
404 406
398 400
400 402
402 404
394 396
396 398
392 394
394 396
396 397
390 392
392 394
388 390
390 392
386 388
388 390
383 385
385 387
387 389
389 391
391 393...

result:

ok good job!

Test #97:

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

input:

52 77
1121111121222122122121212111121121212121112222211112
1121211121111121222121112212212111212222121221111221

output:

32
47 49
49 50
37 38
35 37
33 35
30 31
25 27
27 29
23 25
18 20
20 22
22 24
24 26
26 28
16 18
18 20
20 22
22 24
24 26
15 17
13 15
12 14
14 16
16 18
7 9
5 7
9 11
41 43
40 41
42 44
44 46
51 52

result:

ok good job!

Test #98:

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

input:

334 345
2111211112211221121111211212121122221121222122221211112222221222111111211111111122222212211211111112212211111211211221111111211222112211212111122211121122112212121221111121221211122111211211111222222122121212121111211111112122212212221122111122112112212112212212221221222212222112211121222212...

output:

1168
301 302
71 73
73 74
64 66
66 68
68 70
70 72
63 65
65 67
67 69
62 64
64 66
66 68
60 62
62 64
64 66
59 61
61 63
63 65
65 67
58 60
60 62
62 64
57 59
59 61
61 62
56 58
58 60
55 57
57 58
50 52
52 54
54 56
48 50
50 52
52 54
47 49
49 51
51 53
53 55
46 48
48 50
50 52
45 47
47 48
43 45
42 44
41 43
39 40...

result:

ok good job!

Test #99:

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

input:

322 316
1121211111112222221211212112221112211222112211112111111121211212222222222111122211212122121212221212121221212111122221121112122121212111222212221112122221211221112212122111112122112112122112212211212112222111112111222112221111221222121221212212221212111212121221122112212211111122211111221211...

output:

759
319 321
308 310
310 312
306 308
308 310
310 311
304 306
306 308
299 301
301 303
303 305
305 307
296 298
298 300
300 302
302 304
304 306
294 296
296 298
298 300
300 302
302 304
304 305
290 292
292 294
294 296
296 298
298 300
300 302
302 304
288 290
290 292
292 294
294 296
296 298
287 289
289 291
...

result:

ok good job!

Test #100:

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

input:

28 491
1122122221222111121112122222
2111212121222221121122222121

output:

16
13 15
12 14
11 13
9 11
8 10
10 12
7 9
6 7
4 5
1 3
21 22
22 24
23 25
24 26
25 27
27 28

result:

ok good job!