QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#113432#6546. Greedy Bipartite Matchingvme50AC ✓3786ms12872kbC++171.5kb2023-06-17 19:09:132023-06-17 19:09:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-17 19:09:15]
  • 评测
  • 测评结果:AC
  • 用时:3786ms
  • 内存:12872kb
  • [2023-06-17 19:09:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define pb push_back
int n,m,c,q[N],dst[N],mch[N],ans[N];bool vs[N];bitset<N> tg,tg1;
int cntE,hd[N];struct Edge {int v,pr,sf;}e[N];
void addE(int u,int v) {e[++cntE]=(Edge) {v,0,hd[u]};e[hd[u]].pr=cntE;hd[u]=cntE;}
void dltE(int u,int x)
{if(x==hd[u]) hd[u]=e[x].sf;else e[e[x].pr].sf=e[x].sf,e[e[x].sf].pr=e[x].pr;}
bool bfs()
{
	bool fl=0;fill(vs+1,vs+n+1,0);fill(dst+1,dst+n+1,-1);q[0]=2;q[1]=1;
	for(int i=1;i<=n;++i) if(!mch[i]) dst[i]=0,q[++q[1]]=i;
	while(q[0]<=q[1])
	{
		int u=q[q[0]++];
		for(int i=hd[u],v;i;i=e[i].sf)
		{
			v=e[i].v;
			if(mch[v]) {v=mch[v];if(dst[v]==-1) dst[v]=dst[u]+1,q[++q[1]]=v;}
			else fl=1;
		}
	}return fl;
}
bool dfs(int u)
{
	if(!u) return 1;if(vs[u]) return 0;vs[u]=1;
	for(int i=hd[u],v;i;i=e[i].sf)
	{
		v=e[i].v;
		if((!mch[v] || dst[mch[v]]==dst[u]+1) && dfs(mch[v]))
		{mch[u]=v;mch[v]=u;return 1;}
	}return 0;
}
void slv(int x)
{
	tg=0;while(bfs()) for(int i=1;i<=n;++i) if(!dst[i]) ans[x]+=dfs(i);bfs();
	for(int i=1;i<=n;++i) if(~dst[i]) for(int j=hd[i],v;j;j=e[j].sf)
	{v=e[j].v;if(mch[i]!=v) tg[v]=1;}else tg[i]=1;
	for(int i=1;i<=n;++i) if(tg[i]) for(int j=hd[i],v;j;j=e[j].sf)
	{v=e[j].v;if(tg[v]) dltE(i,j);}tg1|=tg;
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;++i)
	{
		scanf("%d",&c);
		for(int j=1,u,v;j<=c;++j)
		{scanf("%d %d",&u,&v);if(!tg1[u] && !tg1[n+v]) addE(u,n+v);}slv(i);
	}for(int i=1;i<=m;++i) ans[i]+=ans[i-1],printf("%d ",ans[i]);return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 4
2
1 1
1 2
2
1 1
2 2
2
1 3
3 2
1
3 3

output:

1 2 2 3 

result:

ok 4 number(s): "1 2 2 3"

Test #2:

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

input:

0 0

output:


result:

ok 0 number(s): ""

Test #3:

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

input:

2 2
0
2
1 2
1 2

output:

0 1 

result:

ok 2 number(s): "0 1"

Test #4:

score: 0
Accepted
time: 65ms
memory: 12772kb

input:

100000 1
200000
78475 45796
32145 46393
92550 13904
73461 34145
96461 92851
56319 77067
77530 84437
76343 51543
77507 99269
76411 89382
1779 61393
43608 96136
84269 74828
14858 35967
32085 94909
19877 175
1482 94391
12424 55020
64369 92588
81296 7903
25433 46033
36294 61129
73556 84837
8419 10215
12...

output:

100000 

result:

ok 1 number(s): "100000"

Test #5:

score: 0
Accepted
time: 82ms
memory: 12872kb

input:

100000 1
200000
56816 52517
2577 76202
40378 1758
50464 66497
15834 50880
9829 16331
80693 9963
51096 17591
15871 35192
91302 65510
90775 57493
11891 8967
44787 41896
3387 35479
93471 47453
84804 93636
90746 34877
18202 38718
7473 34258
36581 19533
13249 27525
6442 69870
8822 61871
94537 67714
41396...

output:

100000 

result:

ok 1 number(s): "100000"

Test #6:

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

input:

4 1
7
2 2
3 3
1 1
4 2
2 3
3 1
4 3

output:

3 

result:

ok 1 number(s): "3"

Test #7:

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

input:

100000 1
199999
25371 25371
85965 85964
416 416
16797 16797
12438 12438
45410 45409
63006 63005
22156 22156
87829 87828
84014 84014
37308 37308
72325 72325
83704 83704
55391 55390
6781 6780
78091 78091
9376 9376
82193 82193
74695 74695
49842 49842
15799 15799
69856 69855
82949 82948
97390 97389
205 ...

output:

100000 

result:

ok 1 number(s): "100000"

Test #8:

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

input:

100000 1
199999
59470 59470
76774 76773
89517 89517
87041 87041
90185 90185
83076 83076
61455 61455
33616 33616
85795 85794
92073 92072
49726 49726
63843 63842
99248 99248
24122 24122
29553 29552
73534 73534
75846 75846
27030 27029
84419 84419
26637 26637
10101 10100
75014 75013
67342 67342
75647 75...

output:

100000 

result:

ok 1 number(s): "100000"

Test #9:

score: 0
Accepted
time: 81ms
memory: 11296kb

input:

100000 1
199999
22285 45796
32145 44931
58735 13904
57137 34145
7549 92851
56319 11875
77530 85279
27040 51543
77507 94258
69266 89382
67074 61393
86160 96136
83228 74828
14858 19501
32085 73640
86885 175
27269 94391
20021 55020
45358 92588
17834 7903
55802 46033
36294 46558
73556 13747
8419 88394
1...

output:

100000 

result:

ok 1 number(s): "100000"

Test #10:

score: 0
Accepted
time: 68ms
memory: 10572kb

input:

100000 1
199999
4851 52517
2577 29251
69017 1758
85855 66497
48301 50880
83742 16331
98932 9963
38731 17591
15871 13961
91302 97596
81693 57493
11891 59333
5077 41896
23575 35479
93471 65246
61977 93636
96141 34877
18202 35367
64058 34258
25589 19533
13249 91004
6442 83449
99192 61871
94537 16903
73...

output:

100000 

result:

ok 1 number(s): "100000"

Test #11:

score: 0
Accepted
time: 143ms
memory: 8204kb

input:

100000 1
199997
4415 9894
97824 23182
2551 30097
24322 27913
64552 31862
23073 68076
28494 14953
11400 33367
14514 13085
40869 51446
63170 88054
76550 23848
22657 57759
9479 56985
96440 59224
69954 84962
55443 22220
96520 87619
31746 72821
8800 6061
36912 77572
8970 95816
32991 68335
29931 84159
333...

output:

63398 

result:

ok 1 number(s): "63398"

Test #12:

score: 0
Accepted
time: 94ms
memory: 8336kb

input:

100000 1
199998
88398 83466
84749 59029
89875 66158
13827 70123
42158 89836
17150 69739
94515 36029
65168 64957
20523 82579
767 6540
23367 32863
61341 51172
41325 62479
6019 38350
61266 36740
88694 66965
87199 74377
27532 67626
72836 38103
66474 43665
94014 82684
22393 7656
65428 88846
1268 82978
82...

output:

63828 

result:

ok 1 number(s): "63828"

Test #13:

score: 0
Accepted
time: 133ms
memory: 8164kb

input:

100000 1
199999
19916 73760
33590 54291
86580 62788
16261 85328
54723 79797
99874 80572
54928 54473
89925 95257
69135 85704
7329 82391
40585 16916
72524 22756
18765 12473
44987 15352
30916 89510
35447 10869
89920 87243
50945 57679
67164 34842
72434 217
33280 11229
79543 42189
39850 20240
97438 7964
...

output:

63525 

result:

ok 1 number(s): "63525"

Test #14:

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

input:

61379 1
199943
14004 13750
24505 24348
30372 30220
27662 27462
33248 33398
38347 38158
17301 16945
50477 50644
56489 56552
46691 46950
21356 21289
3900 3660
24331 24166
8807 8306
40958 40995
15090 14814
20398 20390
30865 30801
33636 33756
20901 20809
55448 55500
4336 4041
36727 36552
16497 16096
367...

output:

37154 

result:

ok 1 number(s): "37154"

Test #15:

score: 0
Accepted
time: 44ms
memory: 7300kb

input:

61352 1
199960
2271 2420
38843 39328
48789 48844
2494 2636
40184 40660
59755 59011
48981 48994
52509 52277
12893 13196
33812 34566
40261 40701
2117 2290
11743 12134
29440 29943
4257 4393
51423 51264
44696 44995
21601 22166
21667 22209
26473 26786
49980 50039
12100 12516
10540 10817
32737 33402
30808...

output:

37442 

result:

ok 1 number(s): "37442"

Test #16:

score: 0
Accepted
time: 33ms
memory: 8324kb

input:

100000 1
199998
1 13806
1 33642
2 9260
2 62739
2 70692
2 78119
3 41149
4 15766
4 50060
5 96645
6 91522
7 32563
9 2551
9 11397
9 48346
10 14640
10 51058
10 79294
10 92375
11 64734
11 67021
12 7765
12 46823
12 60303
13 8750
13 27870
13 69570
13 71511
14 35685
14 42580
14 82024
15 34779
16 1976
16 6932...

output:

78404 

result:

ok 1 number(s): "78404"

Test #17:

score: 0
Accepted
time: 43ms
memory: 9020kb

input:

100000 1
199998
1 28390
1 41334
1 66667
2 5985
2 15913
4 63754
4 77736
5 25016
5 30451
5 90213
6 66979
6 98910
7 63466
7 78228
7 78951
7 85423
8 1744
8 1869
8 55172
9 37583
10 26492
10 82985
11 29230
11 29812
11 33064
12 10610
12 48602
12 73299
12 95659
13 29065
13 50262
13 63187
13 68617
14 86838
1...

output:

78497 

result:

ok 1 number(s): "78497"

Test #18:

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

input:

100000 1
199997
1 4358
1 35526
1 51858
2 57469
2 94928
2 96005
4 75469
5 20203
5 37103
6 32208
7 8678
7 16776
7 46814
7 75641
8 30807
9 4100
9 26455
9 49377
9 55540
9 67033
10 82363
11 11388
11 33779
11 35353
11 50534
11 54707
12 44869
12 59105
15 80529
15 90601
15 99753
16 10955
16 80520
16 87341
1...

output:

78379 

result:

ok 1 number(s): "78379"

Test #19:

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

input:

77101 1
11866
5 29612
5 62771
5 65606
6 22178
6 57725
15 59633
15 68650
18 9623
19 9222
19 43356
30 19613
31 44429
33 51278
35 53197
36 20940
38 68143
39 34664
39 36433
40 71933
41 62218
42 40292
44 53543
45 22019
45 60540
48 56820
48 76082
50 18327
51 52877
51 58007
52 64710
52 66012
53 26752
53 45...

output:

8453 

result:

ok 1 number(s): "8453"

Test #20:

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

input:

69830 1
148749
1 8566
1 12094
1 12609
3 778
3 8772
4 6107
4 7527
4 10597
4 12200
4 14675
4 17677
5 4644
5 15017
5 17195
7 6949
8 1744
8 7751
9 2306
9 4815
10 4469
10 12247
10 16764
10 17449
11 296
11 12044
11 13972
12 169
12 4448
12 7763
12 15834
12 15994
13 1915
13 3081
13 5650
15 30
16 1676
16 464...

output:

19684 

result:

ok 1 number(s): "19684"

Test #21:

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

input:

61958 1
92222
1 23731
1 34076
1 35526
2 30469
2 61016
4 24510
4 36309
5 8062
5 45186
5 54436
6 32531
6 59289
7 10105
7 56658
11 2204
11 3107
11 33779
12 29822
12 59105
13 27898
15 18851
16 13473
16 14984
16 37132
16 40141
16 49347
16 59902
17 12877
17 32646
19 26572
22 60371
23 39981
23 41045
23 611...

output:

40194 

result:

ok 1 number(s): "40194"

Test #22:

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

input:

36033 1
130375
1 1578
1 16726
1 22302
1 24559
2 5978
2 6739
2 9340
2 25295
3 763
3 6993
3 10208
3 14609
4 4
4 3003
4 25048
5 12403
5 13816
5 15863
6 4728
7 6681
7 8346
7 10058
7 13353
7 17085
8 9879
8 17894
8 21629
8 23893
9 2602
9 13005
9 19100
9 23029
10 2308
10 13012
10 15777
10 22643
12 7389
12 ...

output:

25668 

result:

ok 1 number(s): "25668"

Test #23:

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

input:

99117 1
25214
1 19547
1 37952
2 13805
2 18264
2 38542
2 49320
2 64694
2 81666
2 91778
3 2160
3 8897
5 38135
6 3465
6 52632
7 85972
7 92675
8 5531
8 12992
8 35466
9 12078
9 71947
10 57521
12 75487
12 95228
13 83002
14 83430
14 85533
16 32389
16 49235
16 87160
17 70734
17 95798
18 45028
19 51285
21 38...

output:

12003 

result:

ok 1 number(s): "12003"

Test #24:

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

input:

53098 1
57924
1 263
1 3337
1 7252
3 2977
4 4878
5 3404
5 8280
6 4743
7 2962
7 8902
9 5980
9 8809
10 7823
11 416
13 970
14 1059
16 3593
18 5760
19 7129
20 4462
20 9344
21 5012
21 8943
22 8415
23 5218
23 5267
23 5456
24 5699
24 8698
25 5856
26 1212
26 2831
29 3686
30 1867
30 8646
33 6956
33 7046
34 24...

output:

9415 

result:

ok 1 number(s): "9415"

Test #25:

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

input:

62612 1
153201
1 1820
2 26258
2 34655
2 41967
3 9610
4 19008
4 31307
4 36055
5 36682
5 42044
5 46886
5 54124
6 35273
6 48536
7 9178
7 44478
8 11190
8 17567
8 41427
8 53725
9 13816
9 36016
9 48167
11 1145
11 2929
11 21149
11 21678
11 46646
13 39908
13 53276
14 52580
15 21090
16 39808
17 46514
18 2478...

output:

53671 

result:

ok 1 number(s): "53671"

Test #26:

score: 0
Accepted
time: 10ms
memory: 5956kb

input:

95835 1
31126
8 7490
11 1814
18 1853
19 9254
22 3000
26 1650
29 7089
34 4069
34 6120
35 5652
40 10351
42 5704
44 7513
52 3935
53 4247
56 4276
56 6550
65 8186
67 10081
68 10333
74 6344
74 6433
81 8845
87 1765
88 5647
93 400
96 510
96 9565
103 10599
108 583
122 5614
123 5867
124 7064
126 4181
126 6966...

output:

10716 

result:

ok 1 number(s): "10716"

Test #27:

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

input:

49455 1
192460
1 452
1 2960
1 4381
1 4903
1 9093
1 9319
1 10190
1 11110
1 13731
1 15873
1 17605
1 18558
1 19328
1 19872
1 21172
1 24113
1 26986
1 28369
1 28475
1 29570
1 30904
1 31862
1 35961
1 36792
1 38655
1 40351
1 46165
1 46922
1 47527
1 48227
1 48324
1 48593
1 49187
2 2867
2 8430
2 9732
2 9880
...

output:

5824 

result:

ok 1 number(s): "5824"

Test #28:

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

input:

64506 1
150593
1 4769
1 10543
1 14843
1 20603
2 1267
2 12254
3 472
3 13146
3 14024
3 15191
3 18273
3 22690
5 8150
5 9070
7 358
7 10398
7 10870
7 16798
8 5498
8 19180
9 3469
9 6449
9 11474
9 12456
9 13156
10 752
11 11246
12 10587
12 13267
12 17149
12 20207
12 22536
13 5516
14 375
14 19048
15 11868
15...

output:

23290 

result:

ok 1 number(s): "23290"

Test #29:

score: 0
Accepted
time: 3558ms
memory: 7716kb

input:

100000 1000
33
78475 45796
32145 46393
92550 13904
73461 34145
96461 92851
56319 77067
77530 84437
76343 51543
77507 99269
76411 89382
1779 61393
43608 96136
84269 74828
14858 35967
32085 94909
19877 175
1482 94391
12424 55020
64369 92588
81296 7903
25433 46033
36294 61129
73556 84837
8419 10215
120...

output:

33 197 311 340 497 500 644 778 1331 2256 2430 2515 2536 2758 3521 3741 3830 3858 4049 4231 4424 4818 4897 4990 5026 5161 5239 5308 5379 5492 5493 5558 5638 6038 6427 6494 7125 7211 7610 7775 7924 8165 8247 8802 8901 9063 9170 9222 9261 9295 9301 9435 9452 9718 9897 9938 10022 10124 10232 11196 11300...

result:

ok 1000 numbers

Test #30:

score: 0
Accepted
time: 3524ms
memory: 8348kb

input:

100000 1000
946
56816 52517
2577 76202
40378 1758
50464 66497
15834 50880
9829 16331
80693 9963
51096 17591
15871 35192
91302 65510
90775 57493
11891 8967
44787 41896
3387 35479
93471 47453
84804 93636
90746 34877
18202 38718
7473 34258
36581 19533
13249 27525
6442 69870
8822 61871
94537 67714
41396...

output:

942 1229 1851 2161 2594 2646 2984 3171 3267 3298 3354 3404 4166 4258 4620 4667 5002 5336 5651 6094 6244 6591 6832 7089 7123 7216 7231 7308 7573 7654 7805 7984 8084 8205 8355 8357 8381 8653 8896 9602 9637 9759 9773 10021 10158 10410 10471 10568 10644 10661 10667 10820 10905 11004 11007 11594 12243 12...

result:

ok 1000 numbers

Test #31:

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

input:

4 1000
1
2 2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 1000 numbers

Test #32:

score: 0
Accepted
time: 3189ms
memory: 7220kb

input:

100000 1000
110
25371 25371
85965 85964
416 416
16797 16797
12438 12438
45410 45409
63006 63005
22156 22156
87829 87828
84014 84014
37308 37308
72325 72325
83704 83704
55391 55390
6781 6780
78091 78091
9376 9376
82193 82193
74695 74695
49842 49842
15799 15799
69856 69855
82949 82948
97390 97389
205 ...

output:

110 360 678 750 894 1037 1044 1342 1417 1758 2129 2442 2588 2787 3551 3821 4204 4863 4998 5010 5065 5263 5299 5755 5832 6169 6551 6978 7036 7118 7808 7823 7831 8108 8147 9333 9547 9605 9606 9615 9903 10071 10249 10255 10637 10779 10871 10959 11193 11289 11310 11444 11630 11651 11716 11929 12041 1208...

result:

ok 1000 numbers

Test #33:

score: 0
Accepted
time: 3116ms
memory: 8068kb

input:

100000 1000
67
59470 59470
76774 76773
89517 89517
87041 87041
90185 90185
83076 83076
61455 61455
33616 33616
85795 85794
92073 92072
49726 49726
63843 63842
99248 99248
24122 24122
29553 29552
73534 73534
75846 75846
27030 27029
84419 84419
26637 26637
10101 10100
75014 75013
67342 67342
75647 756...

output:

67 326 420 563 591 732 764 978 1131 1721 2067 2301 2323 2369 2495 2613 2635 2849 2887 3003 3018 3110 3143 3193 3220 3641 3770 3805 3928 4170 4397 4560 4705 4766 4854 4973 5613 5696 6100 6217 6229 6282 6301 6457 6717 6733 6823 6892 6971 7052 7138 7635 7637 7720 7796 8007 8013 8085 8305 8719 8747 8797...

result:

ok 1000 numbers

Test #34:

score: 0
Accepted
time: 3559ms
memory: 8120kb

input:

100000 1000
340
22285 45796
32145 44931
58735 13904
57137 34145
7549 92851
56319 11875
77530 85279
27040 51543
77507 94258
69266 89382
67074 61393
86160 96136
83228 74828
14858 19501
32085 73640
86885 175
27269 94391
20021 55020
45358 92588
17834 7903
55802 46033
36294 46558
73556 13747
8419 88394
1...

output:

340 434 1958 1988 2255 2433 2579 3146 3186 3191 3847 3888 4040 4155 4392 4551 4792 5015 5329 6017 6027 6124 6144 6369 6625 6811 6868 7598 7823 8124 8663 8699 8738 9888 10575 11135 11178 11313 11351 11446 11562 11694 11827 12015 12066 12225 12268 12309 12629 12803 12901 13156 13237 13305 13535 13768 ...

result:

ok 1000 numbers

Test #35:

score: 0
Accepted
time: 3542ms
memory: 8596kb

input:

100000 1000
24
4851 52517
2577 29251
69017 1758
85855 66497
48301 50880
83742 16331
98932 9963
38731 17591
15871 13961
91302 97596
81693 57493
11891 59333
5077 41896
23575 35479
93471 65246
61977 93636
96141 34877
18202 35367
64058 34258
25589 19533
13249 91004
6442 83449
99192 61871
94537 16903
141...

output:

24 165 195 325 656 911 1192 1342 1354 1514 1574 1655 1662 1990 2647 2812 3541 3776 4291 4684 5231 5256 5505 5599 5706 6054 6164 6199 6244 6258 6544 6758 6846 6913 6944 7523 7732 7916 7943 8068 8124 8164 8593 9130 9188 9871 10067 10584 11026 11234 11242 11411 11468 11622 11640 11752 11935 12018 12192...

result:

ok 1000 numbers

Test #36:

score: 0
Accepted
time: 3653ms
memory: 7268kb

input:

100000 1000
243
4415 9894
97824 23182
2551 30097
24322 27913
64552 31862
23073 68076
28494 14953
11400 33367
14514 13085
40869 51446
63170 88054
76550 23848
22657 57759
9479 56985
96440 59224
69954 84962
55443 22220
96520 87619
31746 72821
8800 6061
36912 77572
8970 95816
32991 68335
29931 84159
333...

output:

243 404 465 556 1096 1132 1233 1353 1518 1530 1567 1657 1658 1672 1788 1938 2182 2231 2390 2452 2490 2607 2908 3438 3760 3803 4123 4472 5458 5591 5725 5924 6015 6245 6281 6423 6816 7146 7233 7498 7573 7690 7800 7890 7960 8269 8588 8656 8709 8851 9476 9634 9634 9829 9912 10865 11248 11317 11384 11441...

result:

ok 1000 numbers

Test #37:

score: 0
Accepted
time: 3598ms
memory: 7616kb

input:

100000 1000
118
88398 83466
84749 59029
89875 66158
13827 70123
42158 89836
17150 69739
94515 36029
65168 64957
20523 82579
767 6540
23367 32863
61341 51172
41325 62479
6019 38350
61266 36740
88694 66965
87199 74377
27532 67626
72836 38103
66474 43665
94014 82684
22393 7656
65428 88846
1268 82978
82...

output:

118 646 1061 1067 1254 2308 2487 2615 2884 2899 3415 3526 3561 3578 3618 3636 3720 3816 3868 4226 4504 4719 4752 4983 5040 5053 5089 5136 5179 5180 5228 5398 5460 5599 5704 5981 6069 6182 6210 6556 6602 6664 6761 6804 6970 7095 7215 7424 7531 7556 7628 7688 7721 7775 7923 8062 8229 8327 8327 8499 85...

result:

ok 1000 numbers

Test #38:

score: 0
Accepted
time: 3599ms
memory: 7784kb

input:

100000 1000
368
19916 73760
33590 54291
86580 62788
16261 85328
54723 79797
99874 80572
54928 54473
89925 95257
69135 85704
7329 82391
40585 16916
72524 22756
18765 12473
44987 15352
30916 89510
35447 10869
89920 87243
50945 57679
67164 34842
72434 217
33280 11229
79543 42189
39850 20240
97438 7964
...

output:

367 668 861 1226 1296 1410 1561 2140 2219 2264 2491 2716 2841 3033 3077 3191 3383 3520 3830 4013 4226 4587 5095 5233 5253 5382 5625 5951 6137 6194 6466 6743 6792 6922 6997 7212 7447 7529 7679 7953 8032 8133 8486 8575 8610 8668 9295 9446 9458 9463 9564 9594 9714 9878 10037 10121 10219 10413 10421 104...

result:

ok 1000 numbers

Test #39:

score: 0
Accepted
time: 2117ms
memory: 6972kb

input:

61379 1000
458
14004 13750
24505 24348
30372 30220
27662 27462
33248 33398
38347 38158
17301 16945
50477 50644
56489 56552
46691 46950
21356 21289
3900 3660
24331 24166
8807 8306
40958 40995
15090 14814
20398 20390
30865 30801
33636 33756
20901 20809
55448 55500
4336 4041
36727 36552
16497 16096
367...

output:

454 575 1052 1078 1094 1228 1378 1397 1479 1565 1617 2017 3101 3136 3161 3419 3446 3984 4019 4064 4102 4220 4405 4465 4574 4841 4853 4962 5150 5429 5715 6322 6384 6527 6689 6870 6900 7020 7432 7538 7813 7944 8197 8371 8408 8875 8933 8953 8959 8983 9061 9193 9382 9452 9528 9567 9854 9871 9942 10528 1...

result:

ok 1000 numbers

Test #40:

score: 0
Accepted
time: 2116ms
memory: 5840kb

input:

61352 1000
40
2271 2420
38843 39328
48789 48844
2494 2636
40184 40660
59755 59011
48981 48994
52509 52277
12893 13196
33812 34566
40261 40701
2117 2290
11743 12134
29440 29943
4257 4393
51423 51264
44696 44995
21601 22166
21667 22209
26473 26786
49980 50039
12100 12516
10540 10817
32737 33402
30808 ...

output:

40 108 118 172 402 506 526 724 856 1515 1799 1885 2356 2482 2567 2579 2901 3184 3205 3341 3757 3770 4094 4141 4232 4346 4546 4558 5127 5198 5310 5427 5512 5519 5629 5727 5784 5830 5867 5946 5953 6032 6038 6088 6286 6601 6651 7046 7109 7176 7286 7380 7494 7752 7855 7956 7958 8136 8382 8389 8393 8969 ...

result:

ok 1000 numbers

Test #41:

score: 0
Accepted
time: 2446ms
memory: 8868kb

input:

100000 1000
162
1 13806
1 33642
2 9260
2 62739
2 70692
2 78119
3 41149
4 15766
4 50060
5 96645
6 91522
7 32563
9 2551
9 11397
9 48346
10 14640
10 51058
10 79294
10 92375
11 64734
11 67021
12 7765
12 46823
12 60303
13 8750
13 27870
13 69570
13 71511
14 35685
14 42580
14 82024
15 34779
16 1976
16 6932...

output:

66 86 92 173 331 369 405 492 653 674 749 816 1072 1082 1175 1284 1382 1520 1604 1680 1747 1823 1827 2182 2689 2809 3016 3268 3349 3410 3439 3508 3566 3574 3590 3627 3771 3793 3822 3992 4058 4165 4386 4424 4442 4460 4593 4661 4689 4796 4798 4842 4871 4946 5081 5156 5165 5249 5343 5431 5437 5455 5548 ...

result:

ok 1000 numbers

Test #42:

score: 0
Accepted
time: 2450ms
memory: 9104kb

input:

100000 1000
21
1 28390
1 41334
1 66667
2 5985
2 15913
4 63754
4 77736
5 25016
5 30451
5 90213
6 66979
6 98910
7 63466
7 78228
7 78951
7 85423
8 1744
8 1869
8 55172
9 37583
10 26492
67
10 82985
11 29230
11 29812
11 33064
12 10610
12 48602
12 73299
12 95659
13 29065
13 50262
13 63187
13 68617
14 86838...

output:

9 39 158 279 402 476 480 686 952 1181 1260 1573 1577 1653 1660 1670 1843 1846 1908 2135 2253 2261 2271 2285 2346 2396 2653 2698 2844 2897 2931 2958 3091 3115 3200 3201 3366 3681 3899 3939 4009 4058 4306 4329 4400 4446 4773 4798 4852 4860 4890 5049 5126 5225 5306 5336 5415 5500 5534 5556 5595 5621 56...

result:

ok 1000 numbers

Test #43:

score: 0
Accepted
time: 2488ms
memory: 8228kb

input:

100000 1000
220
1 4358
1 35526
1 51858
2 57469
2 94928
2 96005
4 75469
5 20203
5 37103
6 32208
7 8678
7 16776
7 46814
7 75641
8 30807
9 4100
9 26455
9 49377
9 55540
9 67033
10 82363
11 11388
11 33779
11 35353
11 50534
11 54707
12 44869
12 59105
15 80529
15 90601
15 99753
16 10955
16 80520
16 87341
1...

output:

103 333 346 431 508 703 773 815 928 951 1163 1273 1294 1348 1426 1556 1582 1636 1638 1670 1729 1868 2133 2141 2214 2277 2459 2727 2754 3070 3073 3132 3198 3260 3311 3549 3550 3621 3636 3644 3663 3686 3819 3852 3911 4013 4032 4206 4222 4223 4330 4393 4537 4562 4751 4789 4793 4837 4994 4999 5088 5127 ...

result:

ok 1000 numbers

Test #44:

score: 0
Accepted
time: 1079ms
memory: 6208kb

input:

77101 1000
5
5 29612
5 62771
5 65606
6 22178
6 57725
7
15 59633
15 68650
18 9623
19 9222
19 43356
30 19613
31 44429
50
33 51278
35 53197
36 20940
38 68143
39 34664
39 36433
40 71933
41 62218
42 40292
44 53543
45 22019
45 60540
48 56820
48 76082
50 18327
51 52877
51 58007
52 64710
52 66012
53 26752
5...

output:

2 7 43 48 66 66 78 91 93 95 120 129 143 143 146 180 183 200 211 217 220 229 235 252 268 273 299 309 313 315 319 326 352 352 354 362 363 370 375 400 401 417 417 424 464 493 525 530 530 531 546 571 575 579 595 598 607 612 616 632 660 669 675 695 708 712 732 749 752 789 794 805 816 820 821 826 837 843 ...

result:

ok 1000 numbers

Test #45:

score: 0
Accepted
time: 1862ms
memory: 5652kb

input:

69830 1000
130
1 8566
1 12094
1 12609
3 778
3 8772
4 6107
4 7527
4 10597
4 12200
4 14675
4 17677
5 4644
5 15017
5 17195
7 6949
8 1744
8 7751
9 2306
9 4815
10 4469
10 12247
10 16764
10 17449
11 296
11 12044
11 13972
12 169
12 4448
12 7763
12 15834
12 15994
13 1915
13 3081
13 5650
15 30
16 1676
16 464...

output:

47 56 60 129 296 327 394 484 571 732 782 801 842 852 948 955 1072 1106 1110 1116 1126 1139 1201 1223 1243 1244 1263 1266 1315 1408 1442 1448 1522 1748 1750 1751 1826 1838 1894 1908 1916 2057 2069 2111 2146 2170 2193 2247 2254 2270 2438 2440 2503 2530 2549 2593 2649 2764 2767 2849 2902 2941 2997 3042...

result:

ok 1000 numbers

Test #46:

score: 0
Accepted
time: 1280ms
memory: 5964kb

input:

61958 1000
80
1 23731
1 34076
1 35526
2 30469
2 61016
4 24510
4 36309
5 8062
5 45186
5 54436
6 32531
6 59289
7 10105
7 56658
11 2204
11 3107
11 33779
12 29822
12 59105
13 27898
15 18851
16 13473
16 14984
16 37132
16 40141
16 49347
16 59902
17 12877
17 32646
19 26572
22 60371
23 39981
23 41045
23 611...

output:

42 46 107 128 145 189 223 283 314 336 340 357 451 497 508 530 603 619 623 626 670 672 686 733 740 753 821 832 836 878 893 928 997 1019 1100 1108 1132 1174 1176 1273 1295 1512 1667 1672 1692 1752 1775 1865 1907 1985 2011 2028 2052 2116 2128 2197 2221 2264 2316 2423 2468 2488 2619 2681 2705 2728 2733 ...

result:

ok 1000 numbers

Test #47:

score: 0
Accepted
time: 1662ms
memory: 7244kb

input:

36033 1000
34
1 1578
1 16726
1 22302
1 24559
2 5978
2 6739
2 9340
2 25295
3 763
3 6993
3 10208
3 14609
4 4
4 3003
4 25048
5 12403
5 13816
5 15863
6 4728
7 6681
7 8346
7 10058
7 13353
7 17085
8 9879
8 17894
8 21629
8 23893
9 2602
9 13005
9 19100
9 23029
10 2308
10 13012
15
10 15777
10 22643
12 7389
1...

output:

10 14 20 39 76 138 141 155 155 233 237 238 308 392 419 424 461 478 508 545 562 657 681 704 712 729 744 822 843 870 906 998 1028 1055 1058 1078 1089 1186 1215 1220 1274 1295 1353 1363 1424 1452 1453 1479 1495 1542 1546 1563 1736 1762 1807 1853 1858 1919 1932 1946 1959 2013 2043 2058 2074 2101 2107 21...

result:

ok 1000 numbers

Test #48:

score: 0
Accepted
time: 1329ms
memory: 6548kb

input:

99117 1000
6
1 19547
1 37952
2 13805
2 18264
2 38542
2 49320
49
2 64694
2 81666
2 91778
3 2160
3 8897
5 38135
6 3465
6 52632
7 85972
7 92675
8 5531
8 12992
8 35466
9 12078
9 71947
10 57521
12 75487
12 95228
13 83002
14 83430
14 85533
16 32389
16 49235
16 87160
17 70734
17 95798
18 45028
19 51285
21 ...

output:

2 29 51 80 94 97 103 107 121 123 127 145 149 157 167 179 181 188 208 225 229 231 254 255 268 277 287 324 325 327 346 373 377 377 396 401 403 406 411 422 422 433 450 451 482 534 536 541 545 550 570 570 571 581 584 589 598 610 621 634 641 643 645 648 666 672 673 683 691 699 703 705 707 711 717 727 737...

result:

ok 1000 numbers

Test #49:

score: 0
Accepted
time: 1121ms
memory: 8324kb

input:

53098 1000
67
1 263
1 3337
1 7252
3 2977
4 4878
5 3404
5 8280
6 4743
7 2962
7 8902
9 5980
9 8809
10 7823
11 416
13 970
14 1059
16 3593
18 5760
19 7129
20 4462
20 9344
21 5012
21 8943
22 8415
23 5218
23 5267
23 5456
24 5699
24 8698
25 5856
26 1212
26 2831
29 3686
30 1867
30 8646
33 6956
33 7046
34 24...

output:

44 143 150 219 234 252 252 255 300 309 377 459 468 472 491 511 527 532 559 656 672 680 779 815 931 934 940 993 997 998 1055 1090 1107 1135 1165 1191 1238 1246 1291 1366 1461 1576 1610 1621 1658 1685 1691 1737 1747 1748 1816 1822 1835 1842 1880 1886 1922 1958 1994 1999 2021 2032 2033 2068 2070 2096 2...

result:

ok 1000 numbers

Test #50:

score: 0
Accepted
time: 1568ms
memory: 6744kb

input:

62612 1000
168
1 1820
2 26258
2 34655
2 41967
3 9610
4 19008
4 31307
4 36055
5 36682
5 42044
5 46886
5 54124
6 35273
6 48536
7 9178
7 44478
8 11190
8 17567
8 41427
8 53725
9 13816
9 36016
9 48167
11 1145
11 2929
11 21149
11 21678
11 46646
13 39908
13 53276
14 52580
15 21090
16 39808
17 46514
18 2478...

output:

74 76 92 120 154 198 215 257 293 316 331 353 383 421 427 535 669 720 739 790 844 850 936 988 1073 1085 1107 1132 1140 1159 1271 1292 1307 1414 1456 1470 1509 1515 1548 1554 1602 1624 1681 1816 1916 1988 2152 2258 2260 2372 2450 2596 2656 2684 2696 2796 2796 2797 2985 3051 3231 3285 3317 3326 3429 35...

result:

ok 1000 numbers

Test #51:

score: 0
Accepted
time: 1607ms
memory: 5636kb

input:

95835 1000
22
8 7490
11 1814
18 1853
19 9254
22 3000
26 1650
29 7089
34 4069
34 6120
35 5652
40 10351
42 5704
44 7513
52 3935
53 4247
56 4276
56 6550
65 8186
67 10081
68 10333
74 6344
74 6433
46
81 8845
87 1765
88 5647
93 400
96 510
96 9565
103 10599
108 583
122 5614
123 5867
124 7064
126 4181
126 6...

output:

19 54 87 90 96 146 155 231 233 283 285 321 327 422 424 476 510 534 543 544 562 601 602 602 624 627 636 662 692 721 722 738 768 791 858 982 1100 1331 1336 1347 1364 1386 1400 1430 1460 1460 1505 1535 1544 1545 1545 1583 1606 1615 1648 1693 1704 1749 1764 1797 1816 1835 1856 1857 1874 1901 1927 1929 1...

result:

ok 1000 numbers

Test #52:

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

input:

49455 1000
665
1 452
1 2960
1 4381
1 4903
1 9093
1 9319
1 10190
1 11110
1 13731
1 15873
1 17605
1 18558
1 19328
1 19872
1 21172
1 24113
1 26986
1 28369
1 28475
1 29570
1 30904
1 31862
1 35961
1 36792
1 38655
1 40351
1 46165
1 46922
1 47527
1 48227
1 48324
1 48593
1 49187
2 2867
2 8430
2 9732
2 9880
...

output:

20 26 30 35 40 41 49 52 57 58 62 65 67 75 78 79 79 81 83 87 91 92 112 119 150 151 157 162 163 164 164 172 177 177 184 189 202 225 226 226 245 249 252 260 265 281 285 287 294 297 305 312 315 329 331 342 357 378 390 405 405 410 449 452 456 464 488 491 492 504 506 524 538 543 558 558 561 570 581 583 58...

result:

ok 1000 numbers

Test #53:

score: 0
Accepted
time: 1928ms
memory: 8248kb

input:

64506 1000
25
1 4769
1 10543
1 14843
1 20603
2 1267
2 12254
3 472
3 13146
3 14024
3 15191
3 18273
3 22690
5 8150
5 9070
7 358
7 10398
7 10870
7 16798
8 5498
8 19180
9 3469
9 6449
9 11474
9 12456
9 13156
42
10 752
11 11246
12 10587
12 13267
12 17149
12 20207
12 22536
13 5516
14 375
14 19048
15 11868
...

output:

7 24 36 104 115 129 138 229 239 239 285 298 348 598 609 621 622 712 773 847 900 961 989 1017 1028 1140 1207 1331 1363 1436 1444 1455 1456 1488 1494 1503 1542 1595 1623 1677 1746 1957 1982 2033 2086 2171 2190 2260 2268 2269 2370 2461 2496 2516 2553 2567 2704 2926 2954 2970 2979 2985 3032 3039 3045 31...

result:

ok 1000 numbers

Test #54:

score: 0
Accepted
time: 3581ms
memory: 7244kb

input:

100000 1000
33
79866 26908
16365 96214
83249 34589
27494 62816
44983 32412
69547 56924
36232 95323
11902 96006
83118 54456
5062 90887
1073 35883
90545 61331
89753 91874
10574 82794
30970 6062
51878 99423
79197 13501
47111 25000
16837 35792
88142 26991
8093 92042
24930 68943
17077 51187
59710 86885
8...

output:

33 197 310 339 496 499 643 778 1326 2249 2422 2507 2526 2749 3513 3732 3828 3858 4046 4237 4436 4826 4903 4991 5027 5161 5243 5306 5380 5495 5496 5562 5641 6050 6443 6509 7149 7232 7631 7797 7946 8183 8266 8816 8916 9078 9179 9230 9267 9300 9306 9435 9452 9715 9896 9936 10019 10128 10237 11208 11314...

result:

ok 1000 numbers

Test #55:

score: 0
Accepted
time: 3581ms
memory: 8212kb

input:

100000 1000
946
70545 70067
53675 874
85726 88754
40568 1011
23980 52839
28278 27236
70464 92457
1527 3018
52454 12515
95776 51030
18697 3977
9988 21018
23397 49159
35117 49205
70816 87844
55019 53958
88081 38808
22632 56516
30358 34382
39158 91139
94325 57267
34301 48229
6937 19064
7004 15748
26396...

output:

942 1226 1848 2158 2582 2633 2973 3156 3252 3282 3338 3387 4143 4230 4591 4637 4966 5296 5619 6067 6221 6566 6803 7052 7086 7180 7194 7265 7527 7604 7755 7934 8039 8159 8303 8305 8331 8600 8837 9543 9576 9696 9709 9945 10083 10338 10401 10489 10563 10582 10587 10736 10822 10917 10920 11510 12146 121...

result:

ok 1000 numbers

Test #56:

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

input:

4 1000
1
2 2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok 1000 numbers

Test #57:

score: 0
Accepted
time: 3134ms
memory: 8208kb

input:

100000 1000
110
97024 97023
97294 97294
29923 29922
25384 25383
44690 44689
48348 48347
1170 1169
8513 8512
40312 40311
82241 82240
59246 59246
18027 18026
32139 32138
55280 55280
23283 23283
25048 25048
49551 49551
91486 91485
4442 4441
64199 64198
65355 65354
13539 13538
54374 54373
70215 70214
32...

output:

110 360 679 751 895 1039 1046 1345 1420 1758 2123 2427 2571 2772 3540 3812 4187 4852 4987 4998 5049 5245 5280 5736 5814 6151 6520 6954 7013 7096 7772 7789 7799 8085 8124 9305 9505 9565 9566 9575 9855 10023 10202 10208 10596 10738 10833 10927 11155 11251 11272 11406 11603 11623 11694 11915 12026 1206...

result:

ok 1000 numbers

Test #58:

score: 0
Accepted
time: 3134ms
memory: 7240kb

input:

100000 1000
67
31253 31252
85349 85348
21803 21802
29181 29180
14233 14233
93989 93989
95755 95754
37156 37156
36002 36001
70003 70002
29879 29878
73768 73768
31564 31564
93290 93290
23676 23676
4101 4100
46895 46894
19648 19647
24553 24553
96549 96548
33813 33812
46410 46410
39874 39874
94599 94598...

output:

67 326 420 563 591 731 764 975 1127 1710 2062 2294 2315 2362 2487 2606 2629 2849 2887 3001 3016 3106 3137 3187 3211 3631 3759 3794 3911 4153 4375 4534 4681 4739 4828 4939 5573 5652 6053 6173 6184 6235 6254 6407 6671 6685 6775 6844 6919 7010 7095 7592 7595 7680 7760 7968 7974 8045 8266 8683 8712 8759...

result:

ok 1000 numbers

Test #59:

score: 0
Accepted
time: 3523ms
memory: 8156kb

input:

100000 1000
340
33571 54577
32146 4901
94243 33448
16688 48164
41077 99124
5171 74175
4252 77118
92813 68045
1272 7409
19618 26459
55543 95978
46290 25484
64205 26454
14341 38326
24201 32298
91535 79678
2466 29109
38919 37789
66313 16100
49411 43978
32583 8453
62395 39800
83775 46352
9665 212
94978 ...

output:

339 435 1956 1985 2251 2429 2575 3144 3182 3186 3849 3888 4037 4144 4380 4536 4778 4995 5308 6001 6011 6110 6131 6352 6601 6791 6849 7574 7801 8111 8647 8683 8720 9850 10525 11079 11121 11266 11308 11406 11528 11669 11805 11989 12043 12195 12240 12282 12598 12781 12884 13141 13226 13290 13522 13747 ...

result:

ok 1000 numbers

Test #60:

score: 0
Accepted
time: 3573ms
memory: 7244kb

input:

100000 1000
24
98028 82248
97697 86083
58372 34307
90934 26327
78836 818
88295 65090
10164 66655
69817 86428
55307 88964
72237 9353
99595 87060
3049 59508
36858 12066
14928 59498
21690 80239
2607 2668
34641 17675
37813 76592
17014 52941
76161 53164
81748 29104
54914 78165
65565 60488
2990 56527
141
...

output:

24 165 195 325 656 912 1192 1339 1352 1510 1568 1649 1656 1985 2639 2802 3536 3772 4280 4664 5189 5212 5466 5556 5660 6001 6111 6147 6194 6208 6493 6705 6794 6867 6897 7483 7703 7890 7914 8040 8096 8137 8564 9115 9174 9844 10038 10541 10971 11178 11186 11354 11411 11573 11589 11703 11872 11957 12136...

result:

ok 1000 numbers

Test #61:

score: 0
Accepted
time: 3676ms
memory: 6680kb

input:

100000 1000
243
84420 87329
62158 45158
14534 45387
52183 55287
74262 74941
89142 83814
18839 53457
64840 36556
77130 86857
12258 28012
76307 93096
99056 80659
63260 94062
53587 64469
22892 99164
43821 18898
95301 93282
45248 96578
14337 82032
56458 96829
40522 56962
66982 85581
60416 22731
89606 63...

output:

242 406 470 561 1103 1140 1239 1362 1525 1538 1577 1669 1670 1685 1799 1943 2186 2236 2390 2452 2489 2606 2912 3444 3766 3804 4125 4474 5440 5575 5710 5915 6008 6235 6272 6407 6803 7121 7202 7484 7565 7687 7793 7884 7960 8290 8587 8648 8704 8836 9454 9618 9618 9813 9898 10830 11189 11266 11354 11413...

result:

ok 1000 numbers

Test #62:

score: 0
Accepted
time: 3572ms
memory: 7336kb

input:

100000 1000
118
877 6236
8532 42589
24877 61526
26764 16810
61620 87806
89272 31022
88083 686
54725 8419
9962 42250
2721 92702
9695 38152
75020 72544
30701 505
51033 80433
62291 42223
68340 65118
66400 65550
15836 55506
73947 19183
24495 7442
86671 49511
30658 60668
40759 31566
42574 16692
52461 944...

output:

118 644 1065 1071 1258 2303 2482 2612 2866 2883 3414 3529 3560 3577 3617 3632 3715 3810 3865 4219 4506 4713 4749 4979 5039 5051 5088 5138 5185 5186 5231 5394 5455 5591 5697 5986 6071 6185 6210 6549 6595 6645 6724 6762 6930 7043 7168 7383 7492 7520 7595 7658 7695 7749 7895 8035 8203 8315 8315 8510 85...

result:

ok 1000 numbers

Test #63:

score: 0
Accepted
time: 3593ms
memory: 7780kb

input:

100000 1000
368
67521 20205
77721 80664
66421 1006
51528 11555
41867 65761
27510 56470
1325 24612
33600 9257
54779 84504
40689 1337
62470 25612
37732 19182
13283 81
35398 88695
81655 83178
6908 60149
8827 89017
85944 39297
17453 30275
73949 36377
72054 16688
64935 50839
77447 89323
9044 29998
67972 ...

output:

368 675 866 1229 1304 1423 1578 2161 2244 2286 2525 2749 2870 3054 3097 3216 3408 3549 3856 4044 4257 4608 5111 5252 5270 5399 5654 5977 6151 6205 6493 6775 6820 6947 7019 7240 7474 7561 7712 7989 8057 8160 8516 8615 8650 8710 9314 9471 9482 9489 9597 9627 9737 9904 10063 10144 10247 10443 10449 104...

result:

ok 1000 numbers

Test #64:

score: 0
Accepted
time: 2116ms
memory: 5616kb

input:

61379 1000
458
13900 13636
23000 22803
26218 25927
54710 54674
14815 14548
11203 10933
4898 4579
49829 49953
451 377
25614 25351
45543 45644
16552 16152
36058 35992
4675 4391
37402 37278
10992 10683
5617 5359
48613 48841
20037 19925
42728 42785
51513 51562
49822 49942
57999 58214
53093 53204
35763 3...

output:

453 572 1046 1072 1088 1221 1370 1389 1470 1553 1605 2007 3093 3128 3152 3417 3440 3974 4006 4050 4090 4200 4379 4437 4547 4801 4817 4925 5119 5381 5669 6277 6338 6498 6654 6839 6871 6998 7393 7512 7792 7916 8165 8346 8381 8841 8890 8906 8909 8932 9003 9138 9319 9381 9465 9516 9763 9780 9862 10434 1...

result:

ok 1000 numbers

Test #65:

score: 0
Accepted
time: 2102ms
memory: 7168kb

input:

61352 1000
40
47169 47391
30897 31494
37916 38398
16928 17215
28155 28591
42815 43313
21016 21546
48663 48708
37835 38312
18533 18899
41410 41806
48384 48450
32593 33272
48449 48522
41520 41984
26605 26951
31189 31768
44801 45140
36031 36618
25316 25763
31097 31695
10594 10871
40119 40574
7548 7822
...

output:

40 108 118 173 403 507 529 729 867 1523 1805 1889 2362 2491 2570 2583 2910 3181 3199 3340 3766 3780 4109 4162 4239 4347 4556 4568 5141 5211 5326 5439 5520 5526 5635 5723 5787 5823 5859 5941 5946 6028 6034 6081 6305 6592 6642 7012 7076 7143 7240 7340 7435 7740 7845 7934 7937 8130 8371 8379 8382 8956 ...

result:

ok 1000 numbers

Test #66:

score: 0
Accepted
time: 3786ms
memory: 8000kb

input:

100000 1000
162
28388 52056
16102 8975
26096 11586
55671 36369
13838 78340
96582 15722
75976 78285
21196 73450
37357 39113
46756 41687
49971 14026
9241 67212
10948 6340
96936 91225
27253 8720
63211 33822
61819 95944
56575 24663
78405 41481
48798 21915
60793 41047
98223 55749
26056 29931
37875 50988
...

output:

162 210 228 409 739 828 909 1126 1498 1540 1711 1878 2436 2456 2641 2868 3093 3398 3576 3738 3890 4057 4066 4833 5891 6133 6561 7065 7221 7358 7413 7554 7673 7693 7730 7788 8079 8140 8216 8529 8663 8865 9297 9366 9391 9418 9684 9817 9863 10079 10081 10158 10217 10351 10607 10744 10760 10915 11088 11...

result:

ok 1000 numbers

Test #67:

score: 0
Accepted
time: 3705ms
memory: 8624kb

input:

100000 1000
21
59626 17742
27755 99098
39266 58470
2173 68608
39794 35857
90873 38016
60601 43411
23290 95531
42142 71888
44663 45121
85125 33100
51773 43075
27991 45034
88906 36070
89180 92736
33092 19404
99814 83165
25168 21512
3826 28078
50422 65261
47134 37525
67
20199 63945
91168 88693
55001 99...

output:

21 88 396 678 930 1095 1109 1568 2133 2605 2772 3484 3491 3643 3659 3676 4053 4060 4209 4688 4935 4954 4968 5002 5139 5240 5775 5860 6161 6272 6350 6410 6673 6719 6905 6908 7230 7849 8259 8341 8479 8570 9057 9107 9235 9325 9931 9985 10095 10111 10172 10454 10590 10777 10942 11011 11163 11313 11383 1...

result:

ok 1000 numbers

Test #68:

score: 0
Accepted
time: 3731ms
memory: 7804kb

input:

100000 1000
220
11447 51323
26942 46306
67195 29271
11180 2025
83051 52052
63829 30612
56979 14194
40488 39063
4894 32699
29055 14990
14833 48317
27088 77064
76584 93171
48252 11564
83140 65540
83248 48694
20624 76307
75100 346
11051 40235
65100 23678
68465 24905
38719 49769
77760 26258
4889 95149
5...

output:

220 755 789 987 1160 1611 1755 1855 2091 2146 2610 2840 2896 3001 3163 3453 3508 3617 3621 3683 3806 4110 4661 4679 4827 4961 5354 5885 5943 6581 6587 6716 6843 6968 7065 7514 7517 7647 7677 7690 7741 7786 8048 8120 8225 8432 8466 8810 8852 8857 9071 9184 9477 9521 9897 9979 9992 10068 10364 10376 1...

result:

ok 1000 numbers

Test #69:

score: 0
Accepted
time: 1092ms
memory: 6160kb

input:

77101 1000
5
17216 27138
9331 35501
17266 2551
4397 18477
1515 16692
7
15633 54135
3055 38542
14130 44522
9772 71365
1332 17464
13744 32967
4115 31952
50
9474 26257
14129 73748
8082 17404
16879 9549
13368 30458
6980 26713
9961 30403
738 5293
6957 17716
1420 43034
7524 73011
13321 64110
7768 32691
50...

output:

5 12 62 69 92 93 109 127 131 133 166 178 197 197 201 240 244 266 280 288 291 304 314 333 351 356 391 402 407 409 415 425 454 454 457 468 470 478 483 519 522 543 543 550 601 634 674 682 682 683 700 729 734 739 756 757 771 779 784 805 838 847 857 885 901 910 932 954 957 1003 1010 1028 1043 1050 1051 1...

result:

ok 1000 numbers

Test #70:

score: 0
Accepted
time: 1993ms
memory: 8724kb

input:

69830 1000
130
23877 7421
7789 14179
31061 1129
52257 11874
15402 12514
42220 17635
12336 2497
43491 19655
20261 9246
66971 18376
63353 4591
69079 8740
22829 1342
18294 13028
2445 15559
58499 8064
13510 2923
29987 9023
25723 17410
47434 10976
9184 19458
24778 7333
22058 9787
39699 14711
29856 11395
...

output:

129 158 169 328 731 804 951 1125 1334 1664 1767 1802 1896 1916 2116 2131 2376 2456 2465 2477 2494 2518 2646 2687 2728 2731 2759 2763 2860 3045 3096 3108 3262 3691 3695 3696 3850 3873 3978 4005 4019 4265 4291 4368 4423 4463 4497 4604 4615 4645 4959 4962 5083 5117 5143 5220 5315 5494 5501 5614 5690 57...

result:

ok 1000 numbers

Test #71:

score: 0
Accepted
time: 1790ms
memory: 7068kb

input:

61958 1000
80
48213 60566
19730 38828
9808 19085
28641 7966
53151 39967
867 61214
14579 57750
27522 19684
39420 11260
28702 52529
9958 37976
39959 36924
24622 47577
19303 52698
32127 21813
34590 36636
23460 47013
6544 905
6610 20873
20983 39195
47474 29742
47697 48827
1261 57398
5429 15587
48558 590...

output:

80 92 223 274 308 399 476 617 676 721 729 761 950 1041 1065 1107 1267 1304 1310 1314 1399 1405 1435 1533 1545 1568 1716 1737 1747 1826 1852 1925 2071 2116 2269 2284 2328 2417 2421 2606 2654 3046 3346 3352 3388 3501 3539 3698 3762 3896 3953 3991 4040 4158 4177 4285 4333 4400 4488 4683 4757 4791 5022 ...

result:

ok 1000 numbers

Test #72:

score: 0
Accepted
time: 1457ms
memory: 6612kb

input:

36033 1000
34
12478 6767
29782 21359
8057 12724
35097 7117
16993 14982
12479 2437
15847 17822
1686 3641
7501 23815
28865 10683
448 23382
33292 7289
21332 828
21475 8845
32766 19361
628 1741
6759 384
24238 16958
17286 23122
13168 16759
18222 24184
35924 3720
15849 6067
884 6486
15651 11914
21169 2115...

output:

34 49 72 143 286 530 543 598 602 864 878 885 1122 1406 1488 1499 1608 1661 1765 1902 1949 2264 2335 2425 2450 2502 2543 2767 2816 2897 2989 3264 3346 3425 3435 3498 3520 3767 3850 3862 4012 4070 4211 4240 4401 4477 4479 4552 4591 4708 4716 4753 5164 5228 5344 5463 5474 5645 5680 5726 5756 5898 5979 ...

result:

ok 1000 numbers

Test #73:

score: 0
Accepted
time: 1390ms
memory: 8120kb

input:

99117 1000
6
5288 1422
1440 20429
8790 62531
9260 52972
9485 48133
8105 33807
49
8428 66258
5644 48122
11109 98400
891 33526
11952 6301
12014 87095
3792 96446
10248 11408
10983 52886
12890 82984
3787 40036
627 19176
1378 93711
13155 53490
10973 4925
6605 12541
10836 37721
896 26638
7124 6963
6054 85...

output:

6 55 96 154 188 193 204 212 237 238 246 280 289 305 326 350 356 370 405 438 445 451 492 493 511 534 555 635 640 645 675 727 737 738 782 792 800 807 818 842 843 866 900 903 962 1058 1063 1077 1083 1096 1135 1137 1138 1159 1164 1171 1192 1215 1231 1254 1273 1274 1277 1284 1322 1333 1334 1346 1360 1381...

result:

ok 1000 numbers

Test #74:

score: 0
Accepted
time: 1071ms
memory: 8264kb

input:

53098 1000
67
9778 3426
45865 6182
7482 8179
2457 1181
28132 7477
26385 2321
49451 1686
26635 3443
2322 2723
51334 6839
52640 995
8771 3533
37168 4510
29477 8116
21751 3507
10411 4835
48631 6112
52998 5833
15330 6140
32116 3478
42504 5631
40741 3952
26610 5761
4777 4307
8584 1484
6679 2915
30892 666...

output:

67 227 239 354 377 408 409 414 487 495 610 725 736 741 768 797 819 826 874 1020 1041 1052 1192 1242 1413 1416 1424 1504 1509 1512 1594 1640 1659 1697 1736 1773 1838 1853 1910 2010 2130 2276 2315 2336 2387 2422 2427 2489 2506 2506 2590 2598 2614 2624 2665 2674 2716 2768 2803 2808 2830 2842 2842 2876 ...

result:

ok 1000 numbers

Test #75:

score: 0
Accepted
time: 2331ms
memory: 5984kb

input:

62612 1000
168
32163 31104
38678 47402
11355 5720
31487 14072
52102 29602
20729 42279
39906 43538
5328 24648
24067 23971
34229 34464
14662 54671
24958 19518
27730 50981
27499 23819
48090 26889
20251 4547
28229 13012
37807 62258
663 14971
61475 51380
1599 56720
8322 21526
11153 10707
55870 26141
3073...

output:

168 172 217 298 390 516 559 683 775 841 880 949 1020 1115 1133 1414 1767 1897 1944 2063 2206 2213 2436 2552 2751 2788 2847 2912 2932 2976 3250 3310 3351 3620 3720 3756 3840 3857 3945 3962 4084 4129 4268 4598 4834 4978 5358 5601 5607 5846 6020 6318 6444 6511 6547 6768 6769 6772 7183 7317 7687 7805 78...

result:

ok 1000 numbers

Test #76:

score: 0
Accepted
time: 1596ms
memory: 5576kb

input:

95835 1000
22
19975 9740
47221 3888
11403 7070
62334 8368
25315 11434
4154 8178
14601 6392
11964 3089
71495 10462
21371 10743
25498 1714
33343 212
15282 7943
14221 10072
84081 2189
57952 4893
91041 1132
92410 11146
66153 8053
18352 5547
1738 6825
13707 8344
46
26983 8510
56782 908
29805 4460
2821 11...

output:

22 68 105 112 121 173 186 271 273 331 334 373 380 491 493 555 590 616 626 627 646 685 686 686 710 713 722 749 784 818 818 837 873 894 968 1114 1247 1495 1504 1514 1532 1554 1573 1605 1639 1640 1690 1719 1730 1731 1731 1774 1795 1805 1845 1891 1902 1946 1962 1993 2014 2034 2059 2059 2083 2115 2138 21...

result:

ok 1000 numbers

Test #77:

score: 0
Accepted
time: 432ms
memory: 6192kb

input:

49455 1000
665
352 8901
40 46883
5543 16264
1424 6068
2347 18358
1898 39075
3246 46024
4411 42039
1215 16042
311 1002
2963 13584
219 16297
941 27871
673 13189
3814 42950
3488 19277
706 45153
2298 12866
4808 19517
5786 5946
2521 16403
1000 11743
2157 32499
4525 15928
2874 7918
323 41509
830 348
5543 ...

output:

636 812 917 1063 1177 1211 1404 1484 1599 1619 1707 1789 1850 2019 2075 2105 2121 2141 2186 2277 2352 2371 2757 2852 3296 3312 3383 3441 3449 3460 3465 3553 3621 3630 3701 3765 3893 4100 4111 4116 4275 4314 4336 4400 4435 4532 4560 4576 4618 4643 4673 4712 4730 4794 4800 4856 4917 5015 5067 5114 511...

result:

ok 1000 numbers

Test #78:

score: 0
Accepted
time: 2221ms
memory: 6908kb

input:

64506 1000
25
16404 5110
44069 11773
1274 16163
10136 5660
35665 313
38101 18226
44039 21073
53295 15969
33405 10087
4914 17604
49653 8769
62481 8070
11783 11759
44413 5911
36767 19398
23516 15593
55935 12114
40144 8540
22076 473
29453 14371
34318 3468
12833 19664
29978 10254
31588 20986
42423 19257...

output:

25 66 95 268 293 321 337 565 589 590 696 731 859 1457 1488 1525 1527 1794 1944 2125 2240 2364 2425 2506 2535 2765 2894 3175 3253 3409 3425 3450 3452 3522 3538 3568 3658 3763 3810 3908 4061 4477 4520 4625 4730 4889 4931 5058 5076 5077 5260 5428 5495 5530 5585 5611 5855 6262 6315 6349 6372 6383 6458 6...

result:

ok 1000 numbers

Test #79:

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

input:

5 1
16
1 1
1 2
1 4
2 1
2 3
2 5
3 1
3 2
3 3
3 5
4 2
4 3
4 4
5 1
5 4
5 5

output:

5 

result:

ok 1 number(s): "5"

Test #80:

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

input:

5 2
6
1 5
3 4
3 5
5 1
5 2
5 5
13
1 1
1 2
1 3
1 4
2 2
3 1
3 2
3 3
4 3
4 4
4 5
5 3
5 4

output:

3 5 

result:

ok 2 number(s): "3 5"

Test #81:

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

input:

5 3
9
1 1
1 4
2 4
2 5
3 1
3 3
3 4
5 2
5 4
3
1 2
2 2
4 2
7
2 1
2 3
3 2
3 5
4 3
4 4
5 1

output:

4 5 5 

result:

ok 3 number(s): "4 5 5"

Test #82:

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

input:

5 4
6
1 1
1 2
2 1
3 4
4 5
5 3
5
2 3
2 4
2 5
3 5
5 5
3
2 2
3 3
4 1
4
1 5
4 2
4 3
5 1

output:

5 5 5 5 

result:

ok 4 number(s): "5 5 5 5"

Test #83:

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

input:

5 5
4
1 1
1 2
2 4
5 2
2
2 2
4 4
3
2 1
2 5
3 5
7
1 3
1 4
1 5
3 3
5 1
5 3
5 4
4
4 1
4 2
4 3
5 5

output:

3 3 4 4 5 

result:

ok 5 number(s): "3 3 4 4 5"

Test #84:

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

input:

5 6
5
2 2
2 4
3 1
5 2
5 3
1
1 2
5
1 3
2 5
3 4
4 3
5 1
2
1 5
4 5
3
2 1
3 2
4 4
7
1 1
1 4
3 5
4 1
4 2
5 4
5 5

output:

3 4 4 5 5 5 

result:

ok 6 numbers

Test #85:

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

input:

5 7
1
5 1
7
1 2
1 4
3 3
4 1
4 4
5 3
5 5
0
3
3 5
4 2
5 2
2
1 1
4 3
2
3 2
4 5
6
1 3
2 1
2 2
2 4
3 4
5 4

output:

1 4 4 4 4 4 4 

result:

ok 7 numbers

Test #86:

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

input:

6 1
19
1 1
1 5
2 2
2 3
2 5
2 6
3 1
3 2
3 3
3 4
3 5
3 6
4 1
4 3
4 4
4 6
6 2
6 3
6 4

output:

5 

result:

ok 1 number(s): "5"

Test #87:

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

input:

6 2
10
2 2
3 1
3 3
3 5
4 2
4 4
4 5
6 1
6 2
6 3
10
1 1
1 2
1 6
2 3
2 4
2 6
4 3
5 1
5 3
5 6

output:

4 6 

result:

ok 2 number(s): "4 6"

Test #88:

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

input:

6 3
8
2 5
3 5
4 2
4 4
5 3
5 4
6 5
6 6
11
1 1
1 5
2 1
2 2
3 1
3 2
3 4
4 1
5 1
6 1
6 4
8
1 4
2 3
2 4
2 6
4 3
4 5
5 2
6 2

output:

4 6 6 

result:

ok 3 number(s): "4 6 6"

Test #89:

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

input:

6 4
6
2 3
2 4
4 5
4 6
5 1
6 5
7
1 3
3 2
4 2
5 3
6 1
6 2
6 6
5
1 5
2 1
2 6
3 3
5 5
9
1 1
1 2
2 2
2 5
3 4
3 6
5 2
5 4
6 3

output:

4 6 6 6 

result:

ok 4 number(s): "4 6 6 6"

Test #90:

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

input:

6 5
5
1 1
1 5
1 6
2 2
5 2
9
2 1
2 3
2 6
3 4
4 3
4 6
5 4
5 5
6 1
5
2 4
3 2
3 5
4 1
5 6
5
1 2
2 5
5 3
6 4
6 6
6
1 3
1 4
3 6
4 2
4 5
6 5

output:

2 6 6 6 6 

result:

ok 5 number(s): "2 6 6 6 6"

Test #91:

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

input:

6 6
10
1 4
1 5
1 6
2 4
3 2
5 2
5 3
5 4
6 1
6 6
3
3 1
6 3
6 4
4
2 1
3 4
3 5
6 5
2
4 6
5 6
4
1 2
1 3
4 4
4 5
8
1 1
2 3
3 6
4 1
4 2
4 3
5 1
5 5

output:

5 5 5 6 6 6 

result:

ok 6 numbers

Test #92:

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

input:

6 7
4
2 5
3 5
6 1
6 4
3
1 6
4 3
4 5
3
2 3
3 1
5 3
6
1 5
2 4
3 3
4 4
5 4
6 2
3
2 2
5 1
5 5
10
1 1
1 2
1 3
1 4
2 6
3 4
4 6
5 6
6 3
6 6
4
2 1
3 6
5 2
6 5

output:

2 4 5 5 5 5 6 

result:

ok 7 numbers

Test #93:

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

input:

7 1
21
1 1
1 2
1 4
1 6
2 3
2 4
2 5
2 6
2 7
3 1
3 7
4 1
4 2
4 6
5 3
5 5
5 6
5 7
7 1
7 5
7 6

output:

6 

result:

ok 1 number(s): "6"

Test #94:

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

input:

7 2
13
1 3
2 1
2 4
3 3
4 3
4 5
5 6
5 7
6 1
7 1
7 3
7 5
7 7
17
1 1
1 2
1 4
1 6
2 2
2 3
2 5
3 2
4 6
4 7
5 2
5 4
6 2
6 3
6 4
6 6
6 7

output:

6 7 

result:

ok 2 number(s): "6 7"

Test #95:

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

input:

7 3
14
2 2
2 3
2 4
3 4
3 5
3 6
4 5
4 7
5 2
5 4
6 5
6 6
7 4
7 6
11
1 2
1 4
1 6
2 6
4 1
4 6
5 1
5 7
6 2
7 2
7 5
13
1 1
1 3
1 7
2 5
2 7
3 7
4 2
4 4
5 3
5 5
5 6
7 1
7 3

output:

6 6 7 

result:

ok 3 number(s): "6 6 7"

Test #96:

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

input:

7 4
10
2 1
3 3
3 7
4 1
4 2
5 1
5 7
6 7
7 2
7 7
4
2 5
4 6
4 7
6 5
16
1 3
1 4
1 6
1 7
2 2
2 4
2 6
2 7
3 6
4 3
4 4
5 4
6 4
6 6
7 1
7 5
11
1 1
2 3
3 2
3 4
5 2
5 3
5 6
6 1
7 3
7 4
7 6

output:

4 6 7 7 

result:

ok 4 number(s): "4 6 7 7"

Test #97:

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

input:

7 5
8
1 1
2 7
4 6
4 7
5 3
7 2
7 4
7 7
10
1 6
1 7
2 1
2 3
2 4
2 6
4 5
5 5
6 2
7 5
7
3 1
3 3
4 3
5 4
5 6
5 7
6 5
10
1 2
1 4
2 2
3 5
3 6
4 2
6 6
7 1
7 3
7 6
8
2 5
3 2
3 4
4 1
4 4
6 1
6 4
6 7

output:

5 6 6 7 7 

result:

ok 5 number(s): "5 6 6 7 7"

Test #98:

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

input:

7 6
6
1 4
2 5
3 6
4 3
7 3
7 5
7
1 1
2 2
2 3
3 1
4 1
5 3
7 6
6
1 5
2 7
4 5
6 5
6 6
6 7
11
2 6
3 2
3 4
3 7
4 2
4 4
4 6
5 6
6 3
6 4
7 2
7
1 6
1 7
3 5
4 7
5 4
7 1
7 4
7
1 2
2 1
2 4
5 1
5 2
6 2
7 7

output:

4 5 6 6 6 7 

result:

ok 6 numbers

Test #99:

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

input:

7 7
5
1 5
2 4
3 6
4 2
6 7
11
1 2
1 4
2 1
2 7
3 2
3 7
5 1
5 4
5 6
7 3
7 6
5
4 7
5 3
5 5
6 2
6 4
4
2 6
4 3
4 5
6 1
5
1 6
3 1
4 1
6 6
7 2
5
1 3
2 5
3 5
4 6
7 4
5
2 2
3 3
4 4
5 2
6 5

output:

5 7 7 7 7 7 7 

result:

ok 7 numbers

Test #100:

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

input:

11 121
1
4 2
0
2
3 9
9 9
0
0
3
4 11
9 2
9 7
1
8 1
1
11 6
1
8 6
2
1 10
5 11
0
1
7 8
0
1
10 6
0
0
1
9 11
1
11 1
1
10 9
2
8 7
10 11
1
2 2
0
0
0
3
3 3
6 7
7 1
2
2 5
5 10
1
4 8
2
7 11
9 8
1
2 9
0
0
0
0
0
4
3 4
3 8
4 1
11 3
1
1 6
0
1
9 6
0
1
2 6
0
2
4 4
11 9
0
0
2
7 3
7 6
0
1
5 4
2
3 7
5 9
1
3 2
2
5 3
6 5...

output:

1 1 2 2 2 3 4 5 5 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ...

result:

ok 121 numbers