QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#776690#7490. 我回来了RDFZchenyy100 ✓496ms65312kbC++171.8kb2024-11-23 20:14:592024-11-23 20:15:00

Judging History

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

  • [2024-11-23 20:15:00]
  • 评测
  • 测评结果:100
  • 用时:496ms
  • 内存:65312kb
  • [2024-11-23 20:14:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define MAXN 200005
#define MAXM 1000005

int n,m;
int a[MAXN];
int s[20][MAXN];
int op,h,l,r;

struct Query{
    int op;
    int x,y;
};
Query q[MAXM];

int lg[MAXN];

vector<int> vec[MAXM];

int getmin(int l,int r){
    int lvl=lg[r-l+1];
    return min(s[lvl][l],s[lvl][r-(1<<lvl)+1]);
}

int t[MAXN];
int lowbit(int x){
    return x&(-x);
}
void add(int pos,int val){
    while(pos<=n){
        t[pos]+=val;
        pos+=lowbit(pos);
    }
    return;
}
int query(int pos){
    int ret=0;
    while(pos){
        ret+=t[pos];
        pos-=lowbit(pos);
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);

    memset(s,0x3f,sizeof(s));

    cin>>n>>m; n=n*2;
    q[0].op=1;
    for(int i=1;i<=m;i++){
        cin>>q[i].op;
        if(q[i].op==1){
            cin>>q[i].x;
            s[0][q[i].x]=min(s[0][q[i].x],i);
        }else{
            cin>>q[i].x>>q[i].y;
        }
    }
    
    lg[0]=-1;
    for(int i=1;i<=n;i++){
        lg[i]=lg[i/2]+1;
    }
    for(int i=1;i<=lg[n];i++){
        for(int j=1;j<=n-(1<<i)+1;j++){
            s[i][j]=min(s[i-1][j],s[i-1][j+(1<<(i-1))]);
        }
    }
    
    for(int i=1;i<=n;i++){
        int mint=0;
        vec[0].push_back(i);
        for(int j=1;j<=ceil(n*1.0/i);j++){
            mint=max(mint,getmin(i*(j-1)+1,min(i*j,n)));
            if(mint==0x3f3f3f3f){
                break;
            }
            vec[mint].push_back(i);
        }
    }
    
    for(int i=0;i<=m;i++){
        if(q[i].op==1){
            for(auto j:vec[i]){
                add(j,1);
            }
        }else{
            cout<<query(q[i].y)-query(q[i].x-1)<<endl;
        }
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 4.16667
Accepted
time: 3ms
memory: 47472kb

input:

1000 1000
2 270 992
2 70 531
2 121 832
1 906
1 441
2 133 318
2 679 946
1 419
2 251 979
1 570
1 216
1 159
2 707 909
1 674
2 87 110
1 974
2 96 138
2 561 991
2 425 499
2 752 988
1 190
1 220
1 875
1 802
2 213 955
2 288 547
2 15 205
2 653 961
1 26
1 632
1 840
1 116
1 267
1 189
2 443 707
1 400
1 539
1 441...

output:

723
462
712
186
763
1787
605
24
43
1275
287
696
2646
1016
466
927
839
306
2119
1045
3480
537
1185
1304
135
607
2074
1311
2365
1621
1357
3473
1880
998
711
576
1187
1811
453
2586
837
2252
798
172
1573
1378
3409
3039
1902
3449
1057
2888
1437
1091
2686
3019
1750
2488
1503
1616
1464
1329
96
2311
2216
245...

result:

ok 500 numbers

Test #2:

score: 4.16667
Accepted
time: 8ms
memory: 45036kb

input:

1000 1000
1 999
1 490
2 616 782
1 87
1 610
1 951
2 41 166
2 608 761
1 482
2 240 281
1 920
2 167 399
2 391 444
2 36 366
2 198 472
1 260
1 235
1 335
1 918
1 466
1 821
1 468
2 157 762
1 893
1 670
1 367
2 479 897
1 183
2 145 579
2 68 891
1 78
1 448
1 524
1 973
1 210
1 857
2 16 768
2 447 703
1 764
1 694
...

output:

501
206
462
216
881
216
960
1111
2455
1278
2030
3456
3243
824
3135
2347
432
3141
690
1214
1209
1167
3016
531
663
1722
1575
1188
1278
933
928
1678
3151
4009
148
117
1497
1652
2111
2399
2245
957
519
1709
112
962
3351
1194
419
3207
216
984
357
2132
957
1627
1151
3809
2325
4277
1715
1055
1026
498
1527
3...

result:

ok 485 numbers

Test #3:

score: 4.16667
Accepted
time: 7ms
memory: 45204kb

input:

1000 1000
1 476
1 144
2 119 397
2 164 854
2 566 832
1 207
1 749
2 100 828
2 475 517
1 946
1 919
1 378
1 394
1 29
1 788
2 366 980
2 302 573
2 827 908
2 207 926
1 725
2 39 956
2 144 709
1 77
2 675 728
1 243
2 116 540
1 993
1 809
2 75 169
2 802 923
1 897
2 71 141
1 855
2 206 723
2 34 255
1 854
1 134
2 ...

output:

693
1620
534
2180
129
1917
1001
246
2541
3371
2272
162
1900
521
366
370
2001
1188
3205
69
847
2282
620
293
2445
2539
1673
543
3385
886
1037
360
3152
606
2547
456
456
552
303
2752
1884
1348
44
593
1945
798
685
438
793
93
1477
3073
2257
4145
45
903
2096
704
2478
1003
189
1966
350
1475
2703
3348
856
43...

result:

ok 506 numbers

Test #4:

score: 4.16667
Accepted
time: 4ms
memory: 45048kb

input:

1000 1000
2 721 833
1 51
2 471 688
1 487
2 698 712
2 247 766
2 9 592
1 439
1 25
1 987
2 309 949
2 397 399
2 54 511
1 370
2 256 678
1 814
2 126 480
1 701
2 906 980
2 258 677
2 362 424
1 261
1 785
1 109
2 335 819
1 324
2 40 734
2 81 448
1 768
2 896 907
1 405
2 154 500
1 555
1 174
1 889
2 236 591
2 186...

output:

113
436
30
1280
1369
2074
12
1383
1420
1411
225
1567
252
1614
2854
1821
36
1663
1430
2240
1586
2595
2169
246
4249
843
1107
2788
797
438
3318
236
1544
969
1044
642
2142
39
400
1472
795
183
2009
822
276
3393
3209
759
840
4405
2467
2795
542
2126
502
936
1901
403
4068
4660
63
2621
72
348
1363
1020
884
3...

result:

ok 479 numbers

Test #5:

score: 4.16667
Accepted
time: 268ms
memory: 62780kb

input:

100000 1000000
1 8826
1 47779
1 90554
2 42431 42431
2 9379 9379
1 73998
2 18345 18345
1 98104
1 87189
2 9736 9736
1 43752
2 22124 22124
2 23606 23606
1 87492
1 52852
2 73712 73712
2 1019 1019
2 17896 17896
1 1564
2 8503 8503
1 81743
2 15897 15897
2 37020 37020
2 45814 45814
1 3107
2 7782 7782
2 3414...

output:

4
2
2
2
6
6
3
1
2
3
2
4
4
3
4
4
4
6
7
4
3
5
3
3
6
3
1
7
4
3
12
11
4
4
3
4
3
3
4
4
3
5
17
5
4
10
5
3
4
3
10
4
3
25
3
3
4
3
3
9
3
7
3
11
12
3
3
3
3
4
5
20
4
4
4
5
4
3
13
4
19
5
4
5
3
3
6
3
15
6
16
3
3
17
17
3
3
4
6
12
7
39
7
3
12
13
7
4
3
10
11
1
4
5
5
3
3
4
4
7
3
20
3
5
15
3
5
28
7
5
19
3
5
5
5
5
4
2...

result:

ok 400511 numbers

Test #6:

score: 4.16667
Accepted
time: 315ms
memory: 63248kb

input:

100000 1000000
2 27188 27188
1 71975
2 37092 37092
1 88379
1 61656
2 39270 39270
2 29252 29252
2 30997 30997
2 23788 23788
2 14573 14573
2 13520 13520
2 62798 62798
2 10952 10952
2 36389 36389
2 22393 22393
2 7028 7028
2 25244 25244
2 17472 17472
1 94430
2 1170 1170
2 31221 31221
2 857 857
1 85851
2...

output:

1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
3
3
3
4
6
3
4
1
5
4
4
3
7
6
3
6
5
3
6
4
3
5
8
9
3
5
5
8
3
3
1
3
3
3
3
3
3
3
4
4
5
3
7
6
8
7
6
4
4
3
8
5
4
8
16
6
3
3
3
5
6
3
3
4
6
6
3
3
5
6
9
8
4
4
3
4
3
2
1
11
3
4
5
6
5
4
11
17
4
3
4
5
5
6
24
3
3
3
4
6
15
7
4
4
3
9
1
14
3
4
8
5
4
3
6
4
7
3
8
4
2
6...

result:

ok 599915 numbers

Test #7:

score: 4.16667
Accepted
time: 339ms
memory: 62912kb

input:

100000 1000000
2 45549 45549
1 70613
2 42644 42644
2 66369 66369
2 23123 23123
2 18601 18601
2 16403 16403
2 73327 73327
2 25017 25017
2 58174 58174
1 9527
2 3799 3799
1 2658
1 68336
2 42560 42560
2 51701 51701
2 32292 32292
2 55224 55224
2 44301 44301
1 48835
2 67429 67429
2 71281 71281
2 11151 111...

output:

1
1
1
1
1
1
2
1
1
1
3
3
2
3
3
3
2
2
3
2
2
3
5
6
3
6
2
1
4
3
3
6
6
3
5
3
3
4
3
3
4
3
2
3
3
4
5
6
3
7
3
5
5
4
6
3
8
3
4
2
2
3
9
4
3
3
7
3
14
12
4
3
4
2
3
1
7
4
7
6
3
3
4
11
3
7
1
3
1
5
3
5
6
5
6
7
4
4
6
3
8
5
6
3
1
5
3
4
11
13
3
4
5
4
3
3
3
4
14
22
4
3
3
5
5
5
4
3
3
3
7
4
3
3
1
3
4
9
4
3
1
12
1
1
16
4...

result:

ok 799828 numbers

Test #8:

score: 4.16667
Accepted
time: 167ms
memory: 63720kb

input:

100000 1000000
1 67109
1 66563
1 69271
1 76150
2 29832 29832
1 56049
1 2319
1 39723
1 64002
2 13862 13862
1 79205
1 3328
2 13099 13099
2 38083 38083
1 59237
2 14180 14180
2 74994 74994
1 18115
1 46274
1 59983
1 28288
1 43476
1 94391
1 23902
1 81096
1 5435
1 39572
1 71346
1 82732
1 6945
2 77602 77602...

output:

1
2
2
4
2
3
3
4
3
4
3
4
4
5
2
12
6
7
9
3
16
6
1
9
9
4
14
8
5
10
4
3
4
13
5
4
18
10
9
12
3
3
3
11
7
18
6
3
5
7
5
4
8
5
6
3
4
3
6
4
7
3
7
5
7
14
3
9
4
6
13
5
8
3
5
4
3
4
3
5
10
3
6
3
6
3
4
6
3
11
12
19
24
5
24
12
4
5
5
4
8
9
3
6
4
9
38
4
21
18
11
3
3
6
3
3
4
14
3
10
27
7
3
9
4
4
4
3
9
9
6
3
16
5
27
4
...

result:

ok 199732 numbers

Test #9:

score: 4.16667
Accepted
time: 150ms
memory: 62844kb

input:

100000 1000000
1 40343
1 31193
1 96487
1 51217
1 73281
1 63210
1 61015
1 2452
1 51337
1 24975
1 68761
1 98956
1 51257
1 901
1 54590
1 92357
1 60331
1 26736
1 10387
1 5847
1 42883
1 57499
1 97543
1 96521
1 60291
1 52697
1 95385
1 70924
1 63561
1 42117
1 50300
1 21210
1 49086
1 86438
1 64650
1 33693
1...

output:

39280
33564
147625
358503
219023
282693
3639
16520
41325
102909
43962
168910
222280
49939
365952
96981
159235
110861
188932
266365
171554
142575
46314
41028
99647
336988
41373
113916
17961
132000
129807
292707
32823
233117
319578
192306
325430
72638
10569
259402
48334
13356
76288
77694
129165
21470
...

result:

ok 100001 numbers

Test #10:

score: 4.16667
Accepted
time: 212ms
memory: 62676kb

input:

100000 1000000
1 42756
1 13171
1 82775
1 71817
1 38855
1 52191
1 54364
1 39773
1 9355
1 46135
1 20446
1 85603
1 8386
1 46805
1 28685
1 39101
1 67896
1 64806
1 30868
1 78764
1 16298
1 20258
1 66817
1 18930
1 91730
1 54151
1 92319
1 43285
1 88124
1 33966
1 39746
1 50061
1 84944
1 67688
1 65172
1 71530...

output:

160700
275132
62217
248580
143196
34092
276227
171069
325334
100262
260770
207172
126283
8937
40998
70156
448946
38362
174696
11110
149259
94986
45327
16540
72797
219853
19566
24396
5252
103472
206274
122565
102687
630852
182847
24615
102131
176797
89595
108582
71505
26129
260172
60672
176647
289059...

result:

ok 300001 numbers

Test #11:

score: 4.16667
Accepted
time: 235ms
memory: 62532kb

input:

100000 1000000
1 73499
1 81889
1 82753
1 44385
1 73003
1 63622
1 99555
1 56304
1 13586
1 41316
1 35869
1 12616
1 78335
1 84348
1 90858
1 6768
1 82573
1 64491
1 45118
1 58193
1 53357
1 81648
1 4973
1 84150
1 22589
1 70540
1 99417
1 2529
1 19565
1 72552
1 20394
1 25954
1 54266
1 20695
1 58990
1 67578
...

output:

21668
6615
323927
201823
49035
183055
468676
87042
212508
47481
11919
108921
186962
48341
79857
165980
15723
288795
669298
22005
25650
224698
48870
107116
89582
56255
64419
37346
27576
90236
108621
192025
117480
300319
321910
291383
2426
50598
108027
113604
198981
78144
295907
91980
355116
110503
19...

result:

ok 500001 numbers

Test #12:

score: 4.16667
Accepted
time: 299ms
memory: 62736kb

input:

100000 1000000
1 60835
1 36133
1 65763
1 81275
1 6045
1 87998
1 83691
1 82060
1 69773
1 52034
1 94002
1 76401
1 30782
1 11210
1 16938
1 21216
1 89753
1 53346
1 18548
1 44585
1 92668
1 19700
1 39610
1 48968
1 90915
1 67350
1 54693
1 82923
1 36106
1 87963
1 78415
1 59780
1 44868
1 58038
1 97088
1 8764...

output:

137421
29970
88768
162031
62989
2073
51701
297706
125453
105562
197626
146856
61277
332133
162070
588821
224408
121751
37635
158765
256321
63159
40811
163236
137825
338564
372007
185182
341911
148443
43902
60162
32560
174252
251906
37240
192012
86080
159446
95330
125803
207013
2712
198138
68907
2213...

result:

ok 700001 numbers

Test #13:

score: 4.16667
Accepted
time: 343ms
memory: 61888kb

input:

100000 1000000
1 2624
1 429
1 70324
1 94419
1 52098
1 4862
1 2509
1 61264
1 93264
1 24464
1 29655
1 46845
1 66517
1 83250
1 59736
1 65081
1 29677
1 63592
1 60771
1 88032
1 8669
1 48225
1 49383
1 14
1 87086
1 61033
1 21871
1 95109
1 36040
1 97647
1 18264
1 23864
1 85549
1 55345
1 17763
1 44952
1 5596...

output:

43532
211809
248057
270844
328081
250335
876426
155423
505117
230445
29958
60412
88289
121322
121545
95106
79863
241055
76242
200803
57113
89830
76220
188562
32973
324703
286458
208636
16236
52002
132338
37896
104787
217735
220836
129897
152821
194860
16092
98982
291832
170519
64825
81867
344699
170...

result:

ok 900001 numbers

Test #14:

score: 4.16667
Accepted
time: 248ms
memory: 63072kb

input:

100000 1000000
1 5306
1 79209
1 58089
1 68641
1 59709
1 19084
1 1344
1 7788
1 13029
1 88640
1 68240
1 75242
1 75935
1 57539
1 57347
1 67246
1 9132
1 1545
1 64361
1 74925
1 27172
1 60108
1 78412
1 59570
1 29856
1 86240
1 63281
1 3769
1 19067
1 89492
1 1200
1 49532
1 58957
1 24935
1 57301
1 7826
1 512...

output:

506944
375180
512687
424037
404014
423003
473625
414654
506465
490023
348632
447429
574723
709219
509752
395440
369306
692625
573819
372333
706523
374348
395419
408678
430432
458349
433617
362428
541864
440335
404586
436263
439478
478949
455731
634974
552909
428382
377689
636369
382267
376152
578038...

result:

ok 500001 numbers

Test #15:

score: 4.16667
Accepted
time: 59ms
memory: 53208kb

input:

100000 100000
1 2663
1 94991
1 14540
1 38935
2 7618 90208
2 6332 93474
1 81964
1 92772
1 64411
2 4770 93295
2 261 92940
2 4375 94105
1 51875
2 3440 96602
2 3107 93825
1 52900
1 81825
1 18215
1 89522
2 5133 95021
1 96449
1 65367
2 1221 91929
1 78330
1 25039
1 83697
1 28411
1 28235
2 5184 95095
1 3156...

output:

243116
255834
298206
303757
301426
320064
314011
334543
334407
369429
361775
372450
370865
380326
388450
365190
372140
386140
398660
381331
390043
381015
391825
369829
399106
378396
392816
364860
399333
397631
415600
423524
410676
420889
412590
394801
431906
426998
376206
418445
442244
424464
406234...

result:

ok 49760 numbers

Test #16:

score: 4.16667
Accepted
time: 55ms
memory: 53040kb

input:

100000 100000
1 24884
2 42193 63114
2 12835 78537
2 47571 93329
2 33071 67840
2 31371 33540
2 45542 82514
1 14455
2 36133 66441
2 19447 69233
2 18179 99560
2 12111 50274
2 82544 85932
2 49284 70869
2 17192 68542
2 12462 52795
2 66689 68770
2 75965 82259
2 52475 86313
2 5254 5710
2 37703 83293
1 7214...

output:

41844
119357
91518
69540
4340
73946
60618
105011
169469
84413
6778
43172
110394
89104
4164
12590
67678
457
91182
131458
157387
70108
144763
7872
73940
97684
23844
33636
29412
102296
211173
111234
145604
86989
173634
177633
33197
86812
68233
232964
42216
14277
70279
52760
112481
130224
52680
22503
14...

result:

ok 79761 numbers

Test #17:

score: 4.16667
Accepted
time: 55ms
memory: 53716kb

input:

100000 100000
1 81747
2 31756 74163
2 13561 58425
2 38121 63653
2 49749 52757
2 12465 89247
1 14763
1 13440
1 71435
2 76886 93001
2 52822 57153
1 97449
2 6324 10017
2 25714 69181
1 86055
2 15991 36145
1 43602
1 48123
2 32589 92016
2 53936 71468
2 48484 51289
2 4982 9323
2 8943 60747
1 3064
2 20760 5...

output:

42408
44865
25533
3009
84284
37093
12996
3694
133407
41166
194420
52599
8659
4342
180696
148489
263112
15264
355262
153605
359101
254183
309065
3336
291227
14974
204568
49858
307743
105597
10254
71214
224669
220312
115733
263363
220406
262689
225433
299434
298757
91683
127412
60258
31791
280911
1211...

result:

ok 50017 numbers

Test #18:

score: 4.16667
Accepted
time: 39ms
memory: 53668kb

input:

100000 100000
1 38764
1 61409
2 3016 54683
1 45867
1 36421
1 22224
1 96005
1 85738
1 36687
1 8821
2 50514 65192
1 83652
1 64096
2 977 85114
2 34818 78357
1 69503
1 12890
1 78346
1 90700
1 10743
1 1859
1 60451
1 22251
1 16291
1 41259
1 10052
2 1257 37427
2 4379 43742
1 45422
2 43786 96870
1 83847
2 3...

output:

83508
44037
309140
143805
194491
214109
162606
9240
15618
44421
132789
209450
42610
279414
52071
158740
106965
313904
385549
31383
138840
9237
177066
218161
116591
34332
117725
9978
136297
171515
472116
355243
191992
82701
35652
60978
209808
221806
182536
87924
71511
184924
74331
225425
352458
87435...

result:

ok 20062 numbers

Test #19:

score: 4.16667
Accepted
time: 209ms
memory: 62504kb

input:

100000 1000000
2 4911 50410
1 18088
2 5195 60114
1 66894
1 65264
2 53839 57562
1 64194
1 91
1 11325
2 2404 84967
2 15644 59062
2 7662 22604
1 26614
1 42520
1 19543
1 16866
2 17622 69362
1 71238
2 28270 75604
2 16675 96147
1 51283
2 11061 38681
1 24535
1 22493
1 39994
2 81216 92230
2 9388 65396
1 465...

output:

45500
96947
11172
216714
117598
41694
172979
144987
240383
127350
22030
221097
187723
275831
103477
213414
53268
92792
303952
58056
125719
46034
41329
252898
214905
296016
212666
52938
38634
68046
61581
91036
109268
103214
184973
86853
140237
268060
150224
89502
118799
95272
32375
61417
143680
32577...

result:

ok 399918 numbers

Test #20:

score: 4.16667
Accepted
time: 303ms
memory: 62572kb

input:

100000 1000000
1 53425
2 30982 39737
1 67975
2 74292 83400
1 82761
2 45128 50241
1 96414
2 68516 81468
2 18342 21086
1 70683
1 91858
1 72179
1 91048
2 48543 51109
1 26684
2 54936 71148
1 8139
2 24875 58961
2 44353 92619
2 32778 78210
2 13383 83090
2 6616 31035
2 68739 98635
1 38315
1 97083
2 77033 9...

output:

8756
18218
5114
38859
2745
2567
48639
132769
148655
151728
261533
99147
87469
49995
168379
96627
19600
327123
199946
41111
3598
151253
173683
10358
52128
87100
158207
14271
56400
74721
145611
10074
141427
47238
336812
18564
134826
294843
156324
359484
52497
19320
344291
167263
52639
215757
51708
659...

result:

ok 599997 numbers

Test #21:

score: 4.16667
Accepted
time: 339ms
memory: 62160kb

input:

100000 1000000
1 17727
1 15420
2 9034 93216
2 14196 70538
2 18132 28441
2 12607 51931
1 32242
2 4334 97259
2 11727 59701
1 92605
2 25817 99001
2 66613 94016
2 11924 44027
1 95138
2 57853 92274
1 60723
2 7848 65584
2 7913 57275
2 2983 97596
1 19883
2 50838 61901
2 46102 55845
2 8990 90056
2 18614 844...

output:

164287
113769
20620
78144
192289
109780
200470
80800
79608
103266
194977
169985
293419
33192
30699
267251
233094
16598
105741
55136
243789
189410
49182
280523
278260
213152
283341
38136
142404
95217
37813
80019
88852
204362
168947
323735
13796
200289
58351
293430
14037
147
142623
283759
295428
37539...

result:

ok 800717 numbers

Test #22:

score: 4.16667
Accepted
time: 496ms
memory: 65312kb

input:

100000 1000000
2 30380 90974
2 19653 98082
2 35889 38945
2 5632 77153
2 12370 93208
2 41484 94976
2 30647 76253
2 16639 46690
2 2326 65175
2 54409 70309
1 1
1 2
2 26996 37077
2 18322 85952
2 71036 82796
2 16794 22081
2 21893 26538
2 54398 63568
2 56557 92249
2 69039 83022
2 55448 62890
2 27603 51211...

output:

60595
78430
3057
71522
80839
53493
45607
30052
62850
15901
20164
135262
23522
10576
9292
18342
71386
27968
14886
47218
30424
71728
146848
148034
8736
36338
76120
42054
120766
17162
9892
26006
74248
51484
30646
55914
12714
47816
75584
45102
92402
165066
60598
21366
12738
159366
106206
57018
12864
136...

result:

ok 900192 numbers

Test #23:

score: 4.16667
Accepted
time: 400ms
memory: 65192kb

input:

100000 1000000
2 42 91533
2 6335 93500
2 9170 94276
2 1479 90642
2 6963 95536
2 5706 91855
2 3282 93173
2 9962 99509
2 2996 98058
2 4828 94564
2 2392 95396
2 3903 99847
2 293 97618
2 7422 91284
2 9719 90105
2 5448 98274
2 4772 98462
2 1870 90088
1 1
2 5668 93701
2 7036 90106
2 8704 96189
2 1323 9966...

output:

91492
87166
85107
89164
88574
86150
89892
89548
95063
89737
93005
95945
97326
83863
80387
92827
93691
88219
176068
166142
174972
196690
175326
174296
169758
173618
189162
194208
163072
183386
189298
191936
199212
164036
176176
177498
174762
180560
187786
184118
175496
171924
178808
175316
179522
181...

result:

ok 900130 numbers

Test #24:

score: 4.16667
Accepted
time: 407ms
memory: 65200kb

input:

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

output:

910957
404633
365688
548837
400361
411112
474005
371883
498206
437257
513641
475764
733568
380540
346587
435379
450183
523125
417372
382903
377406
587296
388916
423666
374165
415625
508045
937921
359356
402734
521646
531009
741779
357632
373776
394898
411853
448135
446331
452989
369471
441532
382630...

result:

ok 900001 numbers