QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#760411#3040. ContainerzyxawaAC ✓3ms5220kbC++141.5kb2024-11-18 16:51:292024-11-18 16:51:29

Judging History

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

  • [2024-11-18 16:51:29]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:5220kb
  • [2024-11-18 16:51:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int k,n,m,v,w,a[501],b[501],c[501],f[501][501],p[501][501];
char s[501],t[501];
vector <pair<int,int>> ans,sub[2];
void dfs(int x,int y){
    if(!x&&!y) return;
    if(p[x][y]<2) sub[a[x+y]<=b[x]].push_back({b[x],a[x+y]}),dfs(x-1,y);
    else sub[a[x+y]<=c[y]].push_back({c[y],a[x+y]}),dfs(x,y-1);
}
int main(){
	scanf("%d%d%s%s",&k,&v,s+1,t+1);
    for(int i=1,j=0;i<=k;i++) if(s[i]=='2') a[++j]=i;
    for(int i=1;i<=k;i++) if(t[i]=='2') i&1?b[++n]=i:c[++m]=i;
    memset(f,0x3f,sizeof(f)),f[0][0]=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i<n){
                w=f[i][j]+abs(a[i+j+1]-b[i+1])/2*(v+4)+abs(a[i+j+1]-b[i+1])%2*(v+3);
                for(int k=1;k<=j;k++) w+=c[k]>b[i+1];
                if(f[i+1][j]>w) f[i+1][j]=w,p[i+1][j]=1;
            }
            if(j<m){
                w=f[i][j]+abs(a[i+j+1]-c[j+1])/2*(v+4)+abs(a[i+j+1]-c[j+1])%2*(v+3);
                for(int k=1;k<=i;k++) w+=b[k]>c[j+1];
                if(f[i][j+1]>w) f[i][j+1]=w,p[i][j+1]=2;
            }
        }
    }
    dfs(n,m);
    for(int i:{0,1}) sort(begin(sub[i]),end(sub[i]));
    reverse(begin(sub[1]),end(sub[1]));
    for(auto [t,s]:sub[1]){
        while(t-s>=2) ans.push_back({s,s+2}),s+=2;
        if(s!=t) ans.push_back({s,t});
    }
    for(auto [t,s]:sub[0]){
        while(s-t>=2) ans.push_back({s-2,s}),s-=2;
        if(s!=t) ans.push_back({t,s});
    }
    printf("%d\n",ans.size());
    for(auto [l,r]:ans) printf("%d %d\n",l,r);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 2
11221
21112

output:

2
4 5
1 3

result:

ok good job!

Test #2:

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

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: 1ms
memory: 4828kb

input:

7 2
2212121
1212122

output:

3
1 3
3 5
5 7

result:

ok good job!

Test #4:

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

input:

1 0
1
1

output:

0

result:

ok good job!

Test #5:

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

input:

1 100
2
2

output:

0

result:

ok good job!

Test #6:

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

input:

2 55
12
21

output:

1
1 2

result:

ok good job!

Test #7:

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

input:

3 100
112
211

output:

1
1 3

result:

ok good job!

Test #8:

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

input:

3 99
221
212

output:

1
2 3

result:

ok good job!

Test #9:

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

input:

3 98
111
111

output:

0

result:

ok good job!

Test #10:

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

input:

123 64
222111221111221122211121221221122122211222211112221221212121211221122212111212211222122212122221212121222121221112111112112
211112121222212221122212212122111121121212211211211212212211111221222212121121212222112212222211221211122212111211221122212

output:

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

result:

ok good job!

Test #11:

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

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
6 7
2 4
4 6
3 5
9 10
10 12
14 16
12 14
15 17
13 15
22 24
20 22
18 20
16 18
14 16
17 19
19 21
25 27
23 25
21 23...

result:

ok good job!

Test #12:

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

input:

312 225
1211111122221112212122121121211212111222121212112121211221211122121111121212211221122221212122111111121222121222112121122222222111111211212112222111222221122211222221122112212112121122222121212111121211212222211122212122111221212222122222122211222211221211111221112111121122222122122111211212...

output:

254
306 307
304 306
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
86 88
88 90
90 92
89 91
87 89
84 86
86 88
85 87
81 83
83 85
66 68
68 69
63 65
...

result:

ok good job!

Test #13:

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

input:

5 136
22111
21121

output:

1
2 4

result:

ok good job!

Test #14:

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

input:

401 518
2122122212112221121122221122212212111122222112211121112212211221211211111111111121222112122212122122112112222211212221212211221222212222211212211222221122212221121211112111221112211122121212112222122112122221112111112222121111122111221211212111211222112222112112211112122212111112211221111122...

output:

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

result:

ok good job!

Test #15:

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

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
224 225
222 224
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
29 31
27...

result:

ok good job!

Test #16:

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

input:

442 357
1121121122111122112211222222211112121111122111121122121121112212222222121121111111212122122121222222212122211111211112222221112112122222211122212122222221222211221212211122121221111222112222212122122212212221111121122212221122221111212112211212211222112211122212112211122222112222221221111112...

output:

782
431 433
433 435
435 437
437 439
439 441
438 440
434 436
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
350 352
352 354
354 356
348 350
350 352
352 354
351 353
346 348
348 350
350 352
...

result:

ok good job!

Test #17:

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

input:

499 399
2122122112111122122122111112211112121112121112222111211122112222221221221111212221222211111221221211212211212222112221221212212211121212122122211212212222122122111212111212221121222112111122122111112122211212122221222222211221112212221122122112121212211121121222221121112112111112222211211122...

output:

1316
488 490
490 491
487 489
483 485
485 487
484 486
479 481
481 483
483 484
478 480
477 479
430 432
432 434
428 430
430 432
422 424
424 426
426 428
428 430
425 427
427 429
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: 1ms
memory: 4964kb

input:

36 857
212211211121121112122222121222222222
221221122222212222121112211112221221

output:

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

result:

ok good job!

Test #19:

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

input:

371 54
11122122211122221221111111111112122222112111211111121111111221121212211122121211211112111111121121112122222211121222222211211222211222221222221122211221211211221112222112221121111222122211211211212121112121212111221222221111122222112121112212111121211112222211222222222122212221221221212121212...

output:

1462
334 335
330 332
332 334
326 328
328 330
325 327
327 329
324 326
322 324
324 325
318 320
320 322
322 324
321 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: 1ms
memory: 5004kb

input:

209 349
22122112221111121222122221222211222112221112121122122112221222121121212211211111111212111122222211121221221121211111221212111111112221222222212211222222212212221111212112221222211122212121112122222222211222122
1222112122222212222221222212211212221222121222112122211121111211122222212111221122...

output:

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

result:

ok good job!

Test #21:

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

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
68 70
66 68
65 66
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
10 12
8 10
6 8
7 9
9 11
12 14
10 12
14 16
12 14
20...

result:

ok good job!

Test #22:

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

input:

447 512
1211212211222111221122222111212112111212111121221111122121122111111112121222222211222212111211122121111222221112111211112211121221122122121222221212211222112122221211121211222212112221121221211111111221222111211121121122112211122211212112211121121222121111212112112111111122222122121111211111...

output:

814
413 415
404 406
406 408
408 410
410 412
412 414
405 407
407 409
409 411
411 413
402 404
404 406
406 408
408 410
410 412
403 405
405 407
407 409
409 411
401 403
403 405
405 407
407 409
409 410
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: 1ms
memory: 5092kb

input:

304 553
2222111221212211222222221121121212121212111121212111212212211121121111121222221222211112111111211122212111112111221121211222221222112211212121222212112221111111212121122221222222211121121121221122121212212211212212122121122121121122111211212211221222221211221221211112212222212111111211211111...

output:

609
300 302
302 304
287 289
289 291
291 293
293 295
295 297
297 299
299 301
301 303
296 298
298 300
300 302
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
274 276
276 278
278 280
280 282
282 284
...

result:

ok good job!

Test #24:

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

input:

300 283
1222222212221212221112211121121112112111122122211121112212221222121112211111111112221121111211112122112222211122222221121221112211212112121122122122212221221212122111211221222211122212222122212111122121111221221222122122222111122121111111211222122221221211211111122221212112221211212222211211...

output:

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

result:

ok good job!

Test #25:

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

input:

387 146
2211222121111211111222212111121112121122122212112212122212111222212111121211222222111121221221221121112221111122112122211212211222122211122221122211112111211211222211112212222122211122121222212221112122112211122112211112122211122222111221221121122212211221211111211211212211221122212112212212...

output:

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

result:

ok good job!

Test #26:

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

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
31 33
29 31
27 29
25 27
23 25
21 23
19 21
30 32
28 30
26 28
24 26
22 24
20 22
35 37
33 35
31 33
29 31
27 29
25 27
23 25
34 36
38 40
...

result:

ok good job!

Test #27:

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

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
42 44
44 46
46 48
43 45
40 42
35 37
37 39
4 5
8 10
12 14
10 12
11 13
13 15
14 16
20 22
18 20
16 18
15 16
23 24
26 28
24 26
31 33
29 31
27 29
30 32
32 34
31 32
66 68
64 66
62 64
67 69
65 67
68 70
...

result:

ok good job!

Test #28:

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

input:

231 339
112211112111122222122122111122221111222221221111111121222122112211111221121122121121211221121212221221122111221221212222211221122221122222121111122211121121112111212112211211221211111221211222212122212112122112111211212112111122112
111112211221211112112221211122111222222211222122122112111221...

output:

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

result:

ok good job!

Test #29:

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

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
73 75
75 77
77 79
79 81
81 83
83 85
85 8...

result:

ok good job!

Test #30:

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

input:

33 61
221112222112212211212221112222221
222112222211222112122121112122221

output:

16
5 7
3 5
7 9
11 13
9 11
10 12
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: 2ms
memory: 5148kb

input:

402 243
2211121211221211111221122111221221221112121221211211111221221222211212121111122121111211222222211112112122212211122211122121122212211122222221221121112212122221112222111221122212221111211121222112211122211212111111122221122211122122211122121212122212122112211122111211221222112111112121112212...

output:

570
393 395
395 397
397 399
399 401
391 393
393 395
387 389
389 391
391 393
382 384
384 386
386 388
380 382
382 384
384 386
383 385
378 380
380 382
382 384
381 383
376 378
378 380
380 382
377 379
379 381
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: 2ms
memory: 5020kb

input:

380 225
1122122211112212212122121222211212122222212121112212111221222111121221122112212222212212121122112221122211221211222212211211211212221111211112212112212222111122112211121222222112211122122111112112221211221211112111222221222112112111212121222122212111222122212211112122212111112212112211122222...

output:

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

result:

ok good job!

Test #33:

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

input:

310 958
2222122112221211222222112111112211211221122212211121212221221221212122112221121121222222122121212222121222211211211122212112112122121222222111222212112211212121222112212121121212112212212212121112211111212221222212221112221212212221211122222121221112221222222211121122211212212112212111112122...

output:

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

result:

ok good job!

Test #34:

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

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
31 33
29 31
27 29
25 27
23 25
21 23
19 21
17 19
26 28
24 26
22 24
20 22
18 20
28 30
26 28
24 26
22 24
20 22
33 35
31 33
29 31
27 29
25 27
23 25
21 23
30 32
28 30
26 28
24 26
22 24
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: 1ms
memory: 4984kb

input:

348 808
1212221222122212121111111122121211221212111111222122112211121211211112222212211111221222221211211212111221111222122111121122112111221111211112222212111221221121221211111221111122121121211212121211222121111212122112222111222122111212221211111212121222121111122112112211221121111112111221211122...

output:

300
346 348
344 345
342 343
337 339
339 341
336 337
334 336
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
222 224
224 226
...

result:

ok good job!

Test #36:

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

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
45 47
47 49
46 48
39 41
41 43
40 42
37 39
39 41
36 38
35 36
29 31
31 33
26 28
28 30
27 29
22 24
24 26
26 28
19 21
21 23
23 25
25 27
20 22
22 24
24 26
18 20
20 22
22 24
13 15
15 ...

result:

ok good job!

Test #37:

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

input:

51 563
112111212112122112222111111222121121111121212222112
112111122121211121111212221211121222112212112211212

output:

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

result:

ok good job!

Test #38:

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

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
6 8
4 6
2 4
10 12
8 10
6 8
4 6
5 7
12 14
10 12
8 10
11 13
9 11
16 18
14 16
12 14
10 ...

result:

ok good job!

Test #39:

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

input:

218 200
21211222212221121221212121121121211111212222222212212211221111111111221121221211211111122211112222121122222122222121212111221111221122121112221122211121222122112112122222121221211222222211221112212121122211211121121222
2122111222221111211122221121122212221112211221112122211121212221121222221...

output:

351
211 213
204 206
206 208
208 210
210 212
207 209
203 205
197 198
58 60
60 62
62 63
54 56
56 58
58 60
60 62
57 59
59 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
28 30
30 32
25 27
27 29
29 30
23 25
25 27
18 20
20 22
22 24
21 23
16 18
18 20
20 22
19 2...

result:

ok good job!

Test #40:

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

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
228 230
230 232
232 234
234 236
236 238
229 231
231 233
233 235
235 237
226 228
228 230
230 232
227 229
229 231
224 226
226 228
228 229
222 224
224 226
215 217
217 219
219 221
221 223
223 225
218 220
220 222
222 224
...

result:

ok good job!

Test #41:

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

input:

412 618
1112222122111122221121221122222221121112222212121111111221221222111121122111111122122222112112122121111221121221111221111222121221221121111122111111212122111211221111211211211212211111112222121211222112212121222112121221222122121222211221222112112211222112222121111221212211221122211212222121...

output:

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

result:

ok good job!

Test #42:

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

input:

252 461
211122121121212111111222121212221122112221222222121122211112222221122221122121222121221221111222211112111212111122122212122211111221121111112111122111112212212121111222112121111211122211121221221222211122121112111112112122211111221222111122111111112121
111211122112112121212111211111112221111...

output:

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

result:

ok good job!

Test #43:

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

input:

403 762
1121111121211222121112221221121121112122122211222212211122221221112211212221112212122122122122212211222222212211122121121112122211112222212211112211112122222111112121222211211122111211211112222112211111211111222122222222221112112122111122221211221212211221221112212211121122221221111222212221...

output:

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

result:

ok good job!

Test #44:

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

input:

76 510
2222111212221211121221222112212211112211122222112221211122211121122212122122
2122112112212212121222212122121222221221211211121212211122121221222211122111

output:

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

result:

ok good job!

Test #45:

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

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
37 39
35 37
33 35
31 33
29 31
27 29
43 45
41 43
39 41
37 39
35 37
33 35
31 33
29 31
36 38
34 36
32 34
47 49
45 47
43 45
41 43
39 41
37 39
35 37
33 35
40 42
38 40
36 38
34 36
42 44
40 42
38 40
36 38
49 51
47 ...

result:

ok good job!

Test #46:

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

input:

363 525
1121111112211122212122112212112111112212221221121112111112212212212221121121122212221111111111212112212122211122211222111121122122122121112222111121121111111211212211112221121112112112111211222112112122112212221212212221112222122211221221112212111222212222111122222221222122221212112111212121...

output:

532
331 333
330 332
298 300
300 302
299 301
297 299
299 300
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
9 11
7 9
5 7
3 5
13 15
11 13
9 11
7 9
5 7
8 10
6 8
14 16
12 14
10 12
20 22
18 20
16 18
14 16
15 17
1...

result:

ok good job!

Test #47:

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

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
98 100
100 101
91 93
93 95
95 97
97 99
86 88
88 9...

result:

ok good job!

Test #48:

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

input:

134 865
22212222211222112122112221122122221111121221112211122121112211222212121222222122222112212122212122111121221221121222112212212212112222
22122112121212112121121112222222122212112221221222122222111111221211122212122121222212221221222222212112112222122211211112221112121222

output:

126
92 94
89 90
86 88
83 85
85 86
82 84
81 83
80 82
79 81
77 79
75 77
43 45
42 43
40 42
33 35
35 37
37 39
39 41
34 36
36 38
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: 1ms
memory: 5056kb

input:

274 107
2212222112221112121222212212122212121112121212122111221221221111211211222211211211111122112222112112122122222211222111211222212221121122112211121211112221221121221111212222121211122111222212221222211112122222111212211111112121112222222221212222112222211122211222121111121122
22122212111121221...

output:

682
48 50
50 52
49 51
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: 2ms
memory: 5040kb

input:

414 808
2121221211222112211122122222211112211121122211221122212121222222222222212111121212122112111112121111222222111212122122122222211211112121221221111211121112221112121112122212112222212212122221222222121211112122212212211111222212112112112111221221222121222112112211222121222121122122111121211212...

output:

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

result:

ok good job!

Test #51:

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

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
23 25
21 23
19 21
17 19
15 17
22 24
20 22
18 20
16 18
25 27
23 25
21 23
19 21
17 19
26 28
24 26
22 24
20 22
18 20
29 31
27 29
25 27
23 25
21 23
37 39
35 37
33 35
31 ...

result:

ok good job!

Test #52:

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

input:

117 25
112212222221112122221111222222122211212111122122111121122211121211121222122221122111111211222122221221211121222111222
111122222122122111222212111122112222211121122212122212212211111121112222122212112121211222111112221211112112221222222

output:

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

result:

ok good job!

Test #53:

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

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
295 297
297 299
299 301
301 303
296 298
298 300
300 302
289 291
291 293
293 295
295 297
297 299
299 301
287 289
289 291
291 293
293 295
295 297
297 299
294 296
...

result:

ok good job!

Test #54:

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

input:

416 266
1122121211112212122212111111222122221212211112211122211222222112212211121221121212112211211111222222211212111222121112111112211212111221212112222122112222211112122121111111211111211121212111212111121121212121221122222221222222121221212221111212121212212212212212211121121222211111112112121122...

output:

837
401 402
399 400
397 399
394 396
396 398
391 393
393 395
395 397
388 390
390 392
392 394
394 396
389 391
387 389
382 384
384 386
386 388
383 385
385 387
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
366 368
368 370
370 372
372 374
...

result:

ok good job!

Test #55:

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

input:

122 942
11212212222212221121121211211221222121122222221111121111122222222122212111221222112112111112112221121211221111221212221221
11122212121221112122222112111122211222121111111222222222122111211222121212211121221221121112212222221212112111221212212211

output:

120
96 98
92 94
94 96
83 85
85 87
87 89
89 91
91 93
86 88
88 90
90 92
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: 1ms
memory: 4964kb

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
9 11
7 9
5 7
8 10
6 8
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
20 22
18 20
16 18
14 16
12 14
22 24
20 22
18 20
16 18
14 16
19 21
17 19
24 26
22 24
20 22
18 20
21 2...

result:

ok good job!

Test #57:

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

input:

440 881
1111221112211221121112222212222122221122112221212122121122212221111221221221222212121112112121112221122112112212212211212121122112112112121211221112112221111121121111112112121222212112222112222122221121212112222211111212211222221221111221112221212212122112111212112211211211221112211121222222...

output:

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

result:

ok good job!

Test #58:

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

input:

284 884
21111212121111112111222121122122212122111222212122212211221121211111212211121222112222122212122121211112121122222122222211111112111122212222122221111121221212222221221212221111212211111121111211111222112221212121122112211211111222211122221121121222111212211111122221111121111122211211
1112122...

output:

794
282 284
278 280
277 278
264 266
266 268
268 270
270 272
272 274
274 276
271 273
273 275
262 264
264 266
266 268
268 270
270 272
272 274
265 267
267 269
269 271
271 273
254 256
256 258
258 260
260 262
262 264
264 266
266 268
268 270
270 272
252 254
254 256
256 258
258 260
260 262
262 264
264 266
...

result:

ok good job!

Test #59:

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

input:

422 324
1122222121221221121221212122111112212121211222221221212112222221112112212211111221112221222212122122211121121111211111221222122221122121122221122221221221122122222212222121111121211212222121222222111112212111112221221112111111121122111221121222222112211211222212222121122112221121111112112212...

output:

888
420 422
418 420
413 415
415 417
417 419
410 412
412 414
414 416
416 418
408 410
410 412
412 414
414 416
411 413
413 415
409 411
406 408
408 409
402 404
404 406
403 405
400 402
402 404
401 403
399 401
398 400
397 399
396 398
379 381
381 383
383 385
385 387
387 389
389 391
391 393
393 395
380 382
...

result:

ok good job!

Test #60:

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

input:

247 857
1112211211222111211122112111221222122212221111212121121212221211112122222111221211121121121122221211112221221122121212222122122111212112121211221112112111211222211221122221112222222111122112221122111111121111111211112122112121122211212212121122221
22111112221122221222211122212211112111221111...

output:

583
246 247
240 241
233 234
229 231
225 227
227 229
223 225
225 227
219 221
221 223
223 225
220 222
217 219
219 221
195 197
197 199
199 201
201 203
203 205
205 207
207 209
209 211
211 213
213 215
215 217
217 219
191 193
193 195
195 197
197 199
199 201
201 203
203 205
205 207
207 209
209 211
211 213
...

result:

ok good job!

Test #61:

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

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
248 250
250 252
252 254
254 256
253 255
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: 2ms
memory: 5140kb

input:

456 295
1221111112111221222222121212221222112212111112212221212122122122122211211211122122222212221211122222212211111212121111122222112212121211221121212221122112111221211122121121212121212112122112221122211212111221221211221122211111221211221112221122111112111121222121112112112221222221211122221112...

output:

952
161 163
163 164
159 161
158 160
154 156
156 157
150 152
152 154
154 156
151 153
153 155
147 149
149 151
151 153
146 148
145 147
143 145
145 146
138 140
140 142
142 144
141 143
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: 2ms
memory: 5084kb

input:

463 947
1111221121222222122211112221111122122112211211211211222221121112121121122222211121121122221212212122112121212112111112112222211222121121121111111211121121111111112222112121221121122112111211222221122221222112111221212122221211221111221211222121221111221111222111212122111111121212222111112221...

output:

1304
57 59
59 61
55 57
57 59
56 58
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
87 89
85 87
86 88
...

result:

ok good job!

Test #64:

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

input:

242 384
11212222111222212221111221121211122111212121221121112222122212112222212112112222221112211222112221211221112112212121212122121212211211222212111111221221211211122212122211112212112222221221212112111212222222212121212122211111121121222222112211
2111112111211212221221112211112212112211212221222...

output:

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

result:

ok good job!

Test #65:

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

input:

256 235
2122221122211122222211121122211121221212112122111121221212121122221112222111121122121221222122122221121111122221222221212112121112122121212222222111111222121111222121212212112221222122121221121111121211122222122121222111111122121112212221122211122122122221
21111112221121221112112212111122221...

output:

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

result:

ok good job!

Test #66:

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

input:

464 855
1112211221222222211221211111121111222222121212122122212211221211221222122222111121122111221221111112212111112122221122222212212212222212221211122211121121122221222112121112212212222121222221112211221212211121121221212121222212211212121122212212121111111222111211222222221112212111212122222112...

output:

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

result:

ok good job!

Test #67:

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

input:

321 947
1211121122121112121121212222111212112211121222222212221222121121111122212122221222121111211122112221111122221121122221122122121122212221122121222211112111112212112211221111211111211222212212112222221111221111122211121212212212112211121121221221122222222112112111112221212211211211122211211112...

output:

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

result:

ok good job!

Test #68:

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

input:

268 726
1111222212222222121122221211122121122221112222222121212122211211212121221221112122121222111221222112111212122121212121221111122122111222122212112121121121112221111212212221122212112111221122221222112221121212221211221111112111112121222212122112112222122212212121212212
11112112111221211121221...

output:

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

result:

ok good job!

Test #69:

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

input:

159 708
112122221111122221211112111122111111121111222212111112111122112222112211111112111112221211111212122111221121222111111222211122122122222111211212222122111121112
111122211211121211121211111111122211112112122222212212211111211212111122121212212112122211212221111211221122111211122222112222111212...

output:

235
70 72
69 71
45 47
47 49
43 45
45 47
29 31
31 33
33 35
35 37
37 39
39 41
41 43
43 45
38 40
40 42
19 21
21 23
23 25
25 27
27 29
29 31
31 33
33 35
35 37
37 39
30 32
32 34
17 19
19 21
21 23
23 25
25 27
27 29
29 31
31 33
24 26
26 28
28 30
30 32
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: 1ms
memory: 5060kb

input:

252 78
221121122112221221111121211112121221121212221211212111111111112212122111111212212112212221122111122212222211212122211111111211112111111121122121211121211212122212121212211222122212211111121122111112212211112122112222121112221221112222112111221212222112
1221122222111112121112211111121222111221...

output:

580
248 250
247 248
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
11 13
9 11
10 12
61 63
59 61
57 59
67 69
65 67
63 65
61 63
59 61
62 64
60 62
77 79
75 77
73 75
71 73
69 71
67 69
65 67
63 65
61 63
64 66
62 64
66 68...

result:

ok good job!

Test #71:

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

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
71 73
73 75
75 77
77 79
79 81
81 83
76 78
78 80
69 71
71 73
73 75
75 77
77 79
70 72
72 74
74 76
76 78
67 69
69 71
71 73
73 75
75 77
68 70
70 72
72 74
74 76
65 67
67 69
69 71
71 73
73 75
...

result:

ok good job!

Test #72:

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

input:

451 381
2122121211221222121122122211122222122222221212222112211121211212221211222212112222121212112122222211212211212121222221121211212211121121211222211112122221122221212121222212211221211112222121122111211212111121111221112222122221121111222121212211121121122222111122112111211212122121212221221222...

output:

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

result:

ok good job!

Test #73:

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

input:

239 584
22211122211121121212121122121112121121222121222212111211212211212111112211222221122122212221221222212221212112221221122221212222122221111122122121122212221112221122121221122121221111121212221212221111221221111222221211212221111212222222221
2221212221212211222111212222121221121111122211212121...

output:

333
177 179
179 181
181 183
178 180
175 177
177 179
172 174
174 176
176 178
173 175
175 177
168 170
170 172
172 174
174 176
166 168
168 170
163 165
165 167
164 166
159 161
161 163
163 165
160 162
162 164
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: 5080kb

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
30 32
28 30
26 28
24 26
22 24
29 31
27 29
25 27
23 25
46 48
44 46
42 44
40 42
38 40
36 38
34 36
32 34
30 32
28 30
26 28
24 26
33 35
31 33
29 31
27 29
25 ...

result:

ok good job!

Test #75:

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

input:

484 949
2222111221121222111212122122222111112222221112111111211122211221112222212122111221121221222112212122211222212222121222221121222122122221121111111221112112111111211212112122212212211212122111212122111212111221112112121212121212211211122112112121211211121221111122211121212211212211222111212222...

output:

1354
483 484
151 153
153 155
155 157
157 159
154 156
156 158
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: 0ms
memory: 5088kb

input:

463 392
2222111122111122222112221221121122222222211221111122111222111211211221112221212211122122121221212211222121111221212222112221222112221212211122222122221112211211112111122111121222122211222221221222212212111111222112221222212122121212222222112112122112122211221221211222211121111122121122212122...

output:

1152
452 454
454 456
456 458
458 460
453 455
455 457
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
432 434
434 436
436 438...

result:

ok good job!

Test #77:

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

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
140 142
142 144
144 146
146 148
148 150
150 152
147 149
149 151
139 141
...

result:

ok good job!

Test #78:

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

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
39 41
41 43
40 42
37 39
39 41
34 36
36 38
38 40
35 37
37 39
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
28 30
30 31
22 24
24 26
26 28
23 25
25 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: 5004kb

input:

289 337
2212212212211212221122222221211112121121212121221121222112212121121222122122121112212222212121221212121222111112222111211111121112222211111121212221222211221212111121111221121211112121122222121212211212121112111112212221211212112211112111122222221121111111112212212211222221211221122112111
22...

output:

714
286 288
288 289
282 284
284 286
283 285
278 280
280 282
282 284
279 281
281 283
275 277
277 279
197 199
199 201
196 198
194 196
196 197
192 194
194 196
190 192
192 193
188 190
190 192
171 173
173 175
175 177
177 179
176 178
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: 1ms
memory: 5104kb

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
243 245
245 247
244 246
239 241
241 243
243 245
242 244
240 242
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: 1ms
memory: 4952kb

input:

274 934
1112211122121111121221212211111121111211221222212222121222112121212211212111222221121211111221112122221212222212212112222121122221121212212122121112211212111221221112112221222122121212111112221211212122212221122222111111112121211121211212122212221111111121111221212221121221
22221212122111111...

output:

457
260 262
262 264
255 257
257 259
245 247
247 249
249 251
251 253
253 255
255 257
246 248
248 250
250 252
252 254
254 256
241 243
243 245
245 247
247 249
249 251
251 253
253 255
233 235
235 237
237 239
239 241
241 243
243 245
245 247
247 249
249 251
251 253
244 246
246 248
248 250
250 252
231 233
...

result:

ok good job!

Test #82:

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

input:

230 182
21112111222221222221121121121111212221112112111122212222212111121221211222222212121122112211212211211122221221111111221121222221122112221111111212211121111122121111121212122122211111222211221111222122222222111221112112211221111122
1212122111122212122221212221211212112222122222122211111112211...

output:

286
223 225
151 153
153 154
146 148
148 150
150 152
147 149
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
126 128
128 130
130 132
127 129
129 131
124 126
126 128
...

result:

ok good job!

Test #83:

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

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
77 79
75 77
73 75
71 73
69 71
67 69
6...

result:

ok good job!

Test #84:

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

input:

348 517
2221222112221121121122221221111221121112221121121122121112122111121112112111122222221122221111211121221112211112112222222122211211122212112212111211121222121121121121112212122111212122122221221222211122111221212111212111212211222222111111212221211122221121222111211112111111221222122121211112...

output:

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

result:

ok good job!

Test #85:

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

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
67 69
69 71
71 73
68 70
70 72
64 66
46 48
42 44
44 45
35 37
34 35
32 34
2 4
3 5
8 10
6 8
4 6
7 9
5 7
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
23 25
21 23
19 21
17...

result:

ok good job!

Test #86:

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

input:

438 523
1112121212111122111121111122112111212111221211221121112122211121221211111222222222221111222122221112122111122121111221111221121112211221222221121211222121222122222121211122212212221211122111222122111222221222112221212212121112122222112221122211111121121221122111222121121111221212212121111211...

output:

1409
424 425
416 418
418 420
420 422
409 411
411 413
413 415
412 414
397 399
399 401
401 403
403 405
405 407
407 409
409 411
411 413
408 410
410 412
395 397
397 399
399 401
401 403
403 405
405 407
407 409
409 411
406 408
408 410
388 390
390 392
392 394
394 396
396 398
398 400
400 402
402 404
404 406...

result:

ok good job!

Test #87:

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

input:

81 478
112121122122121122121111111112212222211112211212212111122111211111112121212212121
122221121212121221112111212112111121111212121112112221121111211222121212122111211

output:

64
61 63
63 65
56 58
58 60
60 62
62 64
57 59
59 61
51 53
53 55
55 56
49 51
51 53
48 50
50 52
43 45
45 47
47 49
49 51
46 48
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: 1ms
memory: 4984kb

input:

153 157
212111222111222211212221112211211122112111221111111121122211211111222211122122121111221122122121112121122221122121111111211221122121222221121222111222222
122122111122122121211111222211111122211212221211211221121111212222221121221212122221122222112111112212111212112211122112111122211122221111...

output:

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

result:

ok good job!

Test #89:

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

input:

453 434
2212221211121122211222111221212222221112122122221112112121112111122121121122222221121222112122112122212221222121112121212222122112121122122222211211111111111112111122112212221221211111212112222221122212222211221211121222112212112211112112112211121121122212222112212211122121222112111221211111...

output:

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

result:

ok good job!

Test #90:

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

input:

496 670
1211121111122111221111221111212212121212221122222212222121212121121121212111221112111112211112221211112121222122211221212222221212121122212222221112111221222222111112121222221111122222112221212212212112222221121211212112212122212222212121121221111222221121221111211111222211111221211212222122...

output:

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

result:

ok good job!

Test #91:

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

input:

10 526
2221221221
2122221221

output:

1
2 4

result:

ok good job!

Test #92:

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

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
154 156
156 158
158 160
155 157
157 159
152 154
154 156
156 158
144 146
146 148
148 150
150 152
152 154
...

result:

ok good job!

Test #93:

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

input:

489 819
2111111211211211121222211221221122121211111212121121111112112122121122222111212112212222212122211211112111121211221121121112212111211121212222121222111111112211112121121212122121212221211111121122212121112111222112211222122211221212121112211122121212112212112221121112112212211121222121221211...

output:

1457
477 479
474 476
476 478
475 477
470 472
472 474
455 457
457 459
459 461
461 463
463 465
465 467
467 469
469 471
466 468
468 470
453 455
455 457
457 459
459 461
461 463
463 465
465 467
467 469
460 462
462 464
464 466
466 468
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: 1ms
memory: 4936kb

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
148 150
150 152
152 154
154 156
156 158
149 151
151 153
153 155
145 147
147 149
149 151
151 153
146 148
148 150
150 152
143 145
145 147
147 149
149 151
139 141
141 143
143 145
145 147
147 149
137 139
139 141
141 143
143 145
...

result:

ok good job!

Test #95:

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

input:

374 365
1222211122112221112112222212212111221111221111121212212221111122111222212211121111221211222111112121111221212212211122212212212211212211211111112111121121121122111212221121122121222222221211111222111112211121211122221111122112211211212221121122221112121121122112221111212111211111221111111112...

output:

595
188 189
134 136
136 138
133 135
135 136
128 130
130 132
132 134
127 129
129 130
125 126
110 111
91 93
93 94
90 92
86 88
63 65
56 58
58 60
60 62
57 59
59 61
55 57
57 59
52 54
54 56
56 58
53 55
50 52
52 53
48 50
50 51
41 43
43 45
45 47
47 49
42 44
44 46
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: 5160kb

input:

469 834
1222211111122121211211122121221112112211121212211121112221111112122222111211111112222122111122222221222112121112212212121121121221122212122221121222121212221211122111122121212222112112222111221222212122211121221221222211222122112112211122122221222221112222122112211212122111112112212111221212...

output:

1007
464 466
462 463
417 419
414 416
416 418
415 417
413 414
406 408
408 410
407 409
402 404
404 406
406 408
403 405
405 407
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
383 385
385 387
387 389
389 391
391 393
388 390
390 392
386 388
388 390...

result:

ok good job!

Test #97:

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

input:

52 77
1121111121222122122121212111121121212121112222211112
1121211121111121222121112212212111212222121221111221

output:

32
47 49
49 50
37 38
35 37
33 35
30 31
25 27
27 29
18 20
20 22
22 24
24 26
26 28
16 18
18 20
20 22
22 24
24 26
23 25
12 14
14 16
16 18
15 17
13 15
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: 1ms
memory: 5084kb

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
59 61
61 63
63 65
65 67
60 62
62 64
64 66
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
47 49
49 51
51 53
53 55
48 50
50 52
52 54
46 48
48 50
50 52
45 47
47 48
43 45
42 44
41 43
36 38...

result:

ok good job!

Test #99:

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

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
287 289
289 291
291 293
293 295
295 297
297 299
299 301
...

result:

ok good job!

Test #100:

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

input:

28 491
1122122221222111121112122222
2111212121222221121122222121

output:

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

result:

ok good job!