QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410609#6665. 팀 만들기bachbeo200715 92ms14356kbC++201.7kb2024-05-14 10:25:102024-05-14 10:25:11

Judging History

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

  • [2024-05-14 10:25:11]
  • 评测
  • 测评结果:15
  • 用时:92ms
  • 内存:14356kb
  • [2024-05-14 10:25:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i32 = int;
#define vi vector<i32>
#define int long long
int N,M,Q;


vector<int> build_teams(vi A1,vi B1,vi A2,vi B2,vi L1,vi R1,vi L2,vi R2) {
    N=(int)A1.size();
    M=(int)A2.size();
    Q=(int)L1.size();
    auto C = [&](int i,int j){
        return 1LL*(A1[i]+A2[j])*(B1[i]+B2[j]);
    };
    vector<int> Max(N),res(Q);
    function<void(int,int,int,int)> dnc = [&](int l,int r,int optl,int optr){
        int mid=(l+r)>>1,opt=-1,val=0;
        for(int i=optl;i<=optr;i++){
            if(C(mid,i)>val) opt=i,val=C(mid,i);
        }
        Max[mid]=val;
        if(l<mid) dnc(l,mid-1,opt,optr);
        if(mid<r) dnc(mid+1,r,optl,opt);
    };
    if(Q*(N+M)<=1000000){
        for(int t=0;t<Q;t++){
            dnc(L1[t],R1[t],L2[t],R2[t]);
            res[t]=0;
            for(int i=L1[t];i<=R1[t];i++) res[t]=max(res[t],Max[i]);
        }
    }
    else{
        dnc(0,N-1,0,M-1);
        vector<int> tree(4*N);
        function<void(int,int,int)> build = [&](int l,int r,int id){
            if(l==r){
                tree[id]=Max[l];
                return;
            }
            int mid=(l+r)>>1;
            build(l,mid,id<<1);build(mid+1,r,id<<1|1);
            tree[id]=max(tree[id<<1],tree[id<<1|1]);
        };
        build(0,N-1,1);
        function<int(int,int,int,int,int)> query = [&](int l,int r,int id,int tl,int tr){
            if(tr<l || r<tl) return 0LL;
            if(tl<=l && r<=tr) return tree[id];
            int mid=(l+r)>>1;
            return max(query(l,mid,id<<1,tl,tr),query(mid+1,r,id<<1|1,tl,tr));
        };
        for(int t=0;t<Q;t++) res[t]=query(0,N-1,1,L1[t],R1[t]);
    }
	return res;
}

#undef int

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3788kb

input:

500 499
7 4997
13 4988
20 4983
28 4969
44 4963
49 4922
54 4919
58 4897
71 4893
72 4886
85 4883
102 4879
107 4876
113 4868
128 4845
133 4839
135 4831
138 4821
140 4809
156 4793
178 4780
181 4776
190 4760
196 4756
203 4752
209 4736
225 4728
228 4723
232 4720
235 4709
253 4676
258 4660
260 4645
266 463...

output:

25745327
24221652
25260576
25444230
25944610
26027379
25944610
21794500
25502475
19748843
25944610
25269202
25294500
24084151
25944610
25944610
25923420
25745327
24097815
21842574

result:

ok 20 lines

Test #2:

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

input:

500 499
3 4994
6 4989
12 4978
20 4972
22 4965
32 4949
48 4914
52 4893
56 4875
62 4867
66 4860
80 4840
98 4828
106 4814
108 4788
127 4785
142 4783
177 4775
181 4770
182 4766
191 4764
201 4757
205 4753
235 4743
298 4740
300 4725
326 4720
346 4714
350 4709
373 4703
379 4680
390 4674
391 4643
393 4640
3...

output:

22404249
24625440
24983847
24994621
26178282
25385964
25028495
18972628
24778368
24808000
25212965
24604640
23302608
24979302
22241460
25385964
24155109
26178282
25137864
25619090

result:

ok 20 lines

Test #3:

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

input:

500 499
3 4988
4 4967
8 4953
10 4942
11 4936
13 4930
20 4927
40 4904
43 4897
61 4892
65 4852
70 4849
74 4815
78 4812
90 4801
91 4792
107 4783
116 4781
121 4770
123 4747
125 4738
129 4706
132 4700
134 4698
139 4684
145 4680
148 4667
155 4665
164 4652
181 4651
188 4649
191 4648
199 4646
202 4628
209 4...

output:

25458244
17507070
23722057
23685867
24493896
26156980
21925946
26222616
25564880
25172184
24611064
17491437
25418853
25931580
25669456
25144644
26156980
25931580
17224980
25581918

result:

ok 20 lines

Test #4:

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

input:

500 499
22 5000
23 4994
33 4971
34 4960
35 4949
36 4943
37 4930
66 4891
112 4879
118 4863
132 4859
136 4854
152 4851
153 4848
154 4845
164 4842
180 4814
184 4801
197 4798
211 4794
214 4789
221 4773
226 4770
250 4768
256 4760
265 4728
267 4727
272 4718
288 4693
313 4691
318 4683
340 4676
352 4662
355...

output:

25267216
25648854
24950190
25648854
25648854
25192470
25648854
25267216
25267216
25022088
25648854
25267216
24968784
24378216
25648854
25840997
25648854
25648854
25648854
25822235
25648854
24947710
25822235
25822235
25822235
25267216
25648854
25022088
25509360
25840997
25648854
25648854
25648854
252...

result:

ok 500 lines

Test #5:

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

input:

500 499
4 4995
10 4970
25 4967
29 4960
32 4958
39 4954
44 4937
45 4930
52 4927
64 4912
66 4910
67 4901
69 4897
71 4875
79 4863
81 4852
82 4831
89 4816
98 4805
106 4800
116 4794
121 4785
136 4765
137 4756
144 4743
156 4736
157 4724
159 4721
160 4720
163 4715
166 4707
180 4704
185 4701
197 4697
224 46...

output:

26806923
25439158
26931420
26192385
26651388
26651388
25061382
26931420
26453167
25395564
26931420
26453167
26931420
26453167
26931420
26513175
26931420
26453167
26603521
26931420
26453167
26931420
26263972
26931420
26931420
26453167
26931420
26192385
26931420
26931420
26931420
26931420
26931420
269...

result:

ok 500 lines

Test #6:

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

input:

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

output:

128
126
85
117
156

result:

ok 5 lines

Test #7:

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

input:

5 5
2 8
3 5
4 4
7 3
9 1
1 10
2 9
3 3
5 2
10 1
5
0 4 3 3
2 4 0 0
2 3 2 2
2 2 0 0
1 4 1 1

output:

70
110
60
70
110

result:

ok 5 lines

Test #8:

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

input:

500 499
9 4994
14 4980
28 4978
29 4952
34 4940
62 4930
70 4917
74 4910
82 4901
106 4890
107 4883
110 4872
113 4871
119 4857
128 4853
131 4848
140 4839
144 4828
148 4816
153 4796
156 4786
159 4781
168 4770
181 4730
188 4727
193 4722
194 4721
215 4708
217 4707
232 4691
245 4690
258 4680
260 4667
261 4...

output:

20531749
16972104
21053425
23103696
25098804
25340760
25341680
21832928
21858600
25179924
23973411
21140084
21751158
14683410
23024292
14844505
25260348
18876924
24160328
21938755
24261405
24268965
23674320
23894930
22236925
24992050
5970151
20907068
23901372
24515392
24392200
21902265
24623903
2158...

result:

ok 500 lines

Test #9:

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

input:

500 499
5 4995
36 4981
46 4980
57 4979
71 4978
73 4972
76 4971
78 4959
79 4943
88 4923
95 4913
104 4908
113 4905
126 4897
129 4885
130 4874
173 4857
175 4825
178 4807
184 4804
187 4800
199 4784
202 4773
245 4772
250 4767
251 4766
281 4725
286 4720
287 4699
347 4698
349 4696
362 4693
372 4687
376 468...

output:

24953172
24794000
25335478
24556337
24128202
21977650
20408654
24631050
24409540
23185940
24632584
24312130
23457312
18707214
24737080
24174850
21375835
24631050
24378705
24621552
24900019
20720233
25734498
24871728
23796768
15357936
18732816
24483622
25789992
25660096
25742340
22546506
22812636
242...

result:

ok 500 lines

Test #10:

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

input:

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

output:

112
144
143
135

result:

ok 4 lines

Test #11:

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

input:

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

output:

224
195
152
170

result:

ok 4 lines

Test #12:

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

input:

1 1
9 5
4 7
1
0 0 0 0

output:

156

result:

ok single line: '156'

Test #13:

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

input:

2 2
3 10
6 2
4 7
6 2
10
0 1 0 0
1 1 0 0
0 0 0 0
0 1 0 1
0 1 0 0
0 1 0 0
1 1 1 1
1 1 1 1
0 1 1 1
0 1 0 0

output:

119
90
119
119
119
119
48
48
108
119

result:

ok 10 lines

Test #14:

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

input:

3 3
1 14
3 8
11 3
1 9
10 8
12 5
10
0 0 0 0
2 2 0 2
0 0 0 2
0 2 1 1
1 2 0 1
0 1 1 1
1 1 2 2
1 2 1 2
0 2 0 0
0 0 1 2

output:

46
231
247
242
231
242
195
231
144
247

result:

ok 10 lines

Test #15:

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

input:

5 5
4 19
10 14
15 11
17 3
19 2
2 19
10 7
14 3
15 2
17 1
10
3 4 2 3
0 1 2 3
3 3 1 1
1 4 0 3
3 4 3 3
4 4 3 4
3 4 3 4
0 3 3 4
2 3 0 3
3 3 0 3

output:

186
408
270
510
160
136
160
420
510
418

result:

ok 10 lines

Test #16:

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

input:

7 7
2 19
4 13
5 10
6 6
7 5
10 4
12 3
2 20
6 15
8 12
11 9
14 7
15 6
17 1
10
0 4 0 3
2 3 2 5
2 3 1 3
5 5 2 5
3 5 4 5
1 6 3 4
2 4 2 5
2 6 0 5
1 5 0 1
1 6 0 4

output:

364
323
304
288
264
360
323
324
304
360

result:

ok 10 lines

Test #17:

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

input:

10 10
3 19
5 18
8 17
10 13
12 10
13 9
15 8
16 6
17 5
18 1
1 19
6 15
7 14
9 13
10 12
13 10
14 7
16 5
17 2
18 1
10
0 1 5 5
5 6 0 6
0 5 1 7
5 8 3 7
3 5 1 8
3 5 0 7
0 4 8 8
6 7 0 2
3 4 1 7
6 9 1 7

output:

504
504
567
504
529
529
475
484
529
504

result:

ok 10 lines

Test #18:

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

input:

15 15
2 20
3 19
4 18
5 17
6 16
8 15
9 14
10 12
11 11
12 9
13 7
14 6
15 5
16 3
20 1
1 20
2 19
3 17
4 15
5 14
6 13
7 12
11 11
13 8
14 6
15 5
16 4
17 3
18 2
19 1
10
2 8 2 8
8 12 7 13
2 7 2 3
1 10 1 14
0 13 10 13
1 10 8 12
6 13 3 14
13 14 7 13
5 10 1 3
2 14 2 5

output:

500
484
378
500
460
484
500
378
392
414

result:

ok 10 lines

Test #19:

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

input:

498 499
27 4991
37 4989
49 4978
54 4967
65 4964
70 4963
76 4943
77 4935
110 4903
112 4883
116 4882
118 4871
123 4870
126 4868
130 4860
136 4855
139 4840
146 4817
159 4816
203 4811
235 4810
249 4806
257 4798
259 4795
272 4786
283 4783
288 4781
289 4771
301 4764
302 4745
333 4730
335 4719
345 4713
350...

output:

25059100
26443626
24701330
25664187
24972456
26443626
23704800
24849946
24730376
24024673
25410691
25196431
25882857
20204998
26443626
17370044
26443626
26443626
23404703
25209247
24488802
24843336
25441668
24956295
25078491
25664187
20478964
25459972
25145413
23747913
25078491
25910042
25051490
223...

result:

ok 500 lines

Test #20:

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

input:

423 400
2 4968
60 4946
72 4938
91 4910
95 4899
98 4869
110 4832
116 4827
119 4804
121 4797
122 4795
124 4782
129 4776
131 4774
151 4763
162 4745
163 4722
182 4713
196 4683
200 4679
207 4676
210 4664
223 4621
249 4619
265 4617
275 4615
281 4612
293 4598
301 4597
333 4578
343 4557
346 4547
380 4529
39...

output:

25653405
26650000
6823686
26446696
16542394
25074350
22265488
27134380
26779122
27260832
25686258
23517530
23330238
23661300
22902808
27134380
24632011
25848669
20042100
24981181
26779122
26560890
20610852
25638726
27260832
25973892
26571468
24161598
27167912
26286516
27167912
26944533
25444281
2648...

result:

ok 500 lines

Test #21:

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

input:

500 500
12 4998
18 4994
32 4990
55 4970
57 4961
74 4950
91 4939
96 4937
122 4931
124 4921
127 4881
130 4877
138 4857
159 4846
160 4844
165 4843
166 4836
181 4831
199 4818
212 4809
253 4786
254 4783
272 4755
273 4739
275 4736
298 4734
307 4733
318 4728
321 4719
322 4714
351 4686
353 4681
357 4678
366...

output:

24251001
24408876
25954800
23803350
25912414
24408876
25731552
20675986
25879501
25464547
23738916
25492509
25954800
23163164
24524286
25005420
24258960
19881316
23864274
24884695
25492509
25119900
25452315
24408876
24900444
24991520
24533130
25492509
24649056
24041177
25141164
25194085
25954800
233...

result:

ok 500 lines

Test #22:

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

input:

499 500
241 1998397
2131 1996036
3317 1995104
8667 1992186
10801 1984868
14767 1982136
18355 1981825
18693 1978196
23272 1974799
28185 1974598
29185 1958817
31885 1951969
32657 1949913
36165 1943326
46509 1933617
47554 1932321
48342 1926639
49847 1923024
52698 1920254
55874 1918534
56057 1909221
568...

output:

2543777519646
4037188018786
3407335675545
3875689202860
2620922683140
3925852451433
3993113413520
3986304993216
3879082786800
3952072159232
3916650082440
3813851134401
3990873744520
3699222517536
3990873744520
3305639186176
3521012638454
3903445453051
3699222517536
4037188018786
3889885749401
399675...

result:

ok 500 lines

Test #23:

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

input:

500 498
2298345 998507729
2980882 997472093
8130269 996977292
8487157 995654073
14390861 995619536
18122495 994460979
19697981 987703132
19837504 987502413
19921980 986628758
25501848 984640139
27075607 983516527
27423861 982737873
28099456 981421946
28201694 980745740
29106533 980422598
30799056 97...

output:

763926714192407777
1044720464742592412
1015220808619437216
931240983517370836
1015220808619437216
917072956824113430
1009040844804436710
1015220808619437216
1015220808619437216
1044720464742592412
1014453565559038869
1044720464742592412
883457923860732978
1003474459434227132
987969664308050613
92893...

result:

ok 500 lines

Test #24:

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

input:

500 500
2699813 989376403
5210072 988161802
5996514 985305479
8901886 983612242
9335327 982575905
11148119 981065921
14147246 980967389
15394408 980468514
17583866 973997988
18992711 971195390
19250151 970064522
19997279 969120188
20356773 968865361
20446900 968392035
29650530 967683859
32916008 965...

output:

1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
1148107976640609075
...

result:

ok 500 lines

Test #25:

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

input:

500 500
154 17029
246 16987
264 16971
304 16935
351 16862
460 16837
539 16809
593 16758
735 16722
887 16666
948 16644
997 16580
1005 16525
1136 16480
1305 16451
1331 16424
1339 16404
1499 16345
1635 16324
1698 16310
1859 16296
1960 16275
2110 16264
2139 16255
2173 16225
2328 16184
2355 16144
2362 16...

output:

340200441
270557712
390514904
452277904
345539660
320962581
657633802
411252480
390514904
407284122
844100824
284064927
324615477
325281888
261481296
624764765
463794570
228042534
271199396
371805498
448966035
327866460
517235688
359863526
540863862
871066218
505082130
367192616
411754774
355316016
...

result:

ok 500 lines

Test #26:

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

input:

500 500
96 20674
191 20658
205 20651
283 20617
288 20595
394 20575
543 20569
672 20555
749 20543
839 20536
867 20532
1012 20527
1043 20503
1078 20486
1103 20474
1190 20471
1267 20461
1411 20444
1449 20422
1530 20400
1644 20389
1744 20379
1845 20356
1933 20354
1949 20338
2032 20323
2062 20301
2121 20...

output:

692042312
656063629
734811375
672218001
693207504
709392384
678704540
705901786
704157450
685078240
686927748
705139464
705901786
709392384
701244978
577498376
710981415
662738874
674512392
691136384
676178594
610701430
696083955
708290616
709063596
714256368
689820285
609506640
705973124
705901786
...

result:

ok 500 lines

Test #27:

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

input:

500 500
2 11519
3 11491
4 11358
5 11280
6 11191
7 11074
8 10986
11 10890
14 10785
19 10703
20 10632
21 10589
28 10554
33 10513
40 10496
48 10446
58 10430
68 10386
77 10262
86 10156
89 10154
94 10105
107 10033
120 9975
139 9912
149 9823
171 9743
189 9733
198 9693
200 9604
215 9514
240 9427
260 9329
2...

output:

93907900
183309770
176254892
108691000
183309770
183309770
158131876
118001161
151050345
161351700
168859584
90309926
103956000
183309770
168158676
183309770
172107607
137538063
125402058
107710368
173733536
174576024
183309770
40267975
107704540
162981700
183309770
162981700
178922436
180563555
165...

result:

ok 500 lines

Test #28:

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

input:

500 500
1 5989
12 5977
23 5965
34 5953
45 5941
56 5929
67 5917
78 5905
89 5893
100 5881
111 5869
122 5857
133 5845
144 5833
155 5821
166 5809
177 5797
188 5785
199 5773
210 5761
221 5749
232 5737
243 5725
254 5713
265 5701
276 5689
287 5677
298 5665
309 5653
320 5641
331 5629
342 5617
353 5605
364 5...

output:

32891090
24773058
31623166
32891090
32891090
32891090
32891090
32087846
32891090
31597556
32889896
29921390
32891090
32880416
32891090
29881056
32891090
32877910
31773658
32891090
28802610
32891090
32891090
32891090
32891090
32891090
32891090
32891090
30728146
32891090
31322580
32891090
32891090
328...

result:

ok 500 lines

Test #29:

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

input:

500 500
1 11977
12 11953
23 11929
34 11905
45 11881
56 11857
67 11833
78 11809
89 11785
100 11761
111 11737
122 11713
133 11689
144 11665
155 11641
166 11617
177 11593
188 11569
199 11545
210 11521
221 11497
232 11473
243 11449
254 11425
265 11401
276 11377
287 11353
298 11329
309 11305
320 11281
33...

output:

65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65161694
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
65771198
36135088
65771198
65771198
65771198
65771198
65771198
657...

result:

ok 500 lines

Test #30:

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

input:

500 500
1 11977
23 11953
45 11929
67 11905
89 11881
111 11857
133 11833
155 11809
177 11785
199 11761
221 11737
243 11713
265 11689
287 11665
309 11641
331 11617
353 11593
375 11569
397 11545
419 11521
441 11497
463 11473
485 11449
507 11425
529 11401
551 11377
573 11353
595 11329
617 11305
639 1128...

output:

131518440
131518440
131043120
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
131518440
99043336
131518440
131518440
131518440
131518440
131518440
131518440
1...

result:

ok 500 lines

Test #31:

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

input:

500 500
1 1498
3 1495
5 1492
7 1489
9 1486
11 1483
13 1480
15 1477
17 1474
19 1471
21 1468
23 1465
25 1462
27 1459
29 1456
31 1453
33 1450
35 1447
37 1444
39 1441
41 1438
43 1435
45 1432
47 1429
49 1426
51 1423
53 1420
55 1417
57 1414
59 1411
61 1408
63 1405
65 1402
67 1399
69 1396
71 1393
73 1390
7...

output:

1499000
1501500
1499000
1352672
1501500
1499000
1499000
1501500
1501500
1501500
1499000
1499000
1499000
1229760
1198392
1333332
1501500
637912
991496
1499000
1501500
1501500
1498632
1499000
1201072
1499000
1429232
869792
1501500
1499000
1499000
1499000
1499000
1499000
1109360
525352
1499000
1490860
...

result:

ok 500 lines

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #32:

score: 0
Wrong Answer
time: 14ms
memory: 4656kb

input:

200 100000
5503165 995149221
8266588 995002422
21946668 992986739
25413933 990349572
28299421 973255250
37124968 968549011
43496864 968064488
55669193 966554644
76135027 965428022
85004974 962069232
87848601 955359834
91164522 943903417
91874732 940891045
92514264 939556809
102898246 938039042
10439...

output:

991771176978169000
997169453782500570
1001388688412349108
1048201661831053238
1048201661831053238
1001388688412349108
1045816375530230055
1001388688412349108
1001388688412349108
1045816375530230055
1001388688412349108
996958478183707776
1001388688412349108
1001388688412349108
996958478183707776
1001...

result:

wrong answer 1st lines differ - expected: '984901378753241934', found: '991771176978169000'

Subtask #3:

score: 10
Accepted

Test #47:

score: 10
Accepted
time: 52ms
memory: 8680kb

input:

200 100000
335635 996427627
4368692 990235584
10335314 971208588
11639195 971143844
23801483 970115479
31489602 959110431
31544396 956821351
48348198 954187112
48509739 953684848
51173262 952420589
53207608 941523603
62582103 940608015
65545228 932323862
73708623 932037283
80559453 929148992
9033280...

output:

993958698780308505
1059275121529352398
1059275121529352398
1059275121529352398
979409542016948625
1059275121529352398
1059275121529352398
1059275121529352398
1059275121529352398
972560707248716820
1011171607306697480
1043073690916288143
1059275121529352398
1059275121529352398
1059275121529352398
976...

result:

ok 100000 lines

Test #48:

score: 0
Accepted
time: 73ms
memory: 12784kb

input:

100000 200
7562 999982578
14646 999979176
17023 999979047
34088 999949939
37355 999947606
40085 999942853
40792 999940456
72137 999934048
72263 999925995
79201 999923265
87366 999919444
97276 999912192
103443 999911341
120687 999891503
146435 999889738
164344 999872694
172096 999863794
178303 999858...

output:

1069902366797007919
1069902366797007919
1069902366797007919
1069254556645554928
1063111838684534044
1069902366797007919
1068412512308048640
1069902366797007919
1056708009742831080
1067211552446582418
1069902366797007919
1069902366797007919
1069902366797007919
1068460792490386888
1069753760449784022
...

result:

ok 100000 lines

Test #49:

score: 0
Accepted
time: 88ms
memory: 14152kb

input:

98789 99793
35 1999975
55 1999937
66 1999922
67 1999867
72 1999865
122 1999863
162 1999854
248 1999847
262 1999832
292 1999826
294 1999818
306 1999816
309 1999804
310 1999802
328 1999765
329 1999742
361 1999740
369 1999710
375 1999650
406 1999648
425 1999630
439 1999595
447 1999555
482 1999538
490 1...

output:

4012824131136
4001757949106
4010298254544
4008730710900
4010035262788
4002137227950
4006896391645
4031949411396
4002137227950
4031949411396
4032240593001
4030485471355
4026788313484
4032240593001
4030149206642
4030801525394
4002137227950
4032240593001
4031949411396
4028880682610
4019635580893
400689...

result:

ok 99999 lines

Test #50:

score: 0
Accepted
time: 86ms
memory: 14004kb

input:

98789 100000
4076 999975218
26154 999973862
55680 999966500
57738 999963674
67001 999960970
69097 999934828
73606 999900945
81941 999891106
92817 999866052
92907 999839529
94140 999824967
100557 999819292
114266 999812477
114483 999807552
121649 999807152
141904 999786637
149766 999781048
181288 999...

output:

1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1003965970917682420
1002590546600391228
1003965970917682420
1003841501934961518
1001899815905131520
1003965970917682420
...

result:

ok 99999 lines

Test #51:

score: 0
Accepted
time: 80ms
memory: 14312kb

input:

100000 99793
5 1999985
16 1999942
44 1999922
57 1999912
61 1999909
78 1999878
81 1999875
93 1999865
121 1999845
128 1999839
131 1999836
154 1999830
168 1999826
170 1999823
186 1999797
195 1999788
214 1999771
229 1999730
231 1999710
259 1999706
268 1999703
269 1999669
300 1999633
316 1999617
340 1999...

output:

4008160829581
3992310227788
4008160829581
4006875947973
4008160829581
4008160829581
3991389370092
4003235111092
4002457451370
3992172136113
4006875947973
4008160829581
4003235111092
4002457451370
4007893180672
3992172136113
4002457451370
3995045497096
3990980087865
3995045497096
4008160829581
400245...

result:

ok 99999 lines

Test #52:

score: 0
Accepted
time: 83ms
memory: 14240kb

input:

100000 99999
28 1999977
125 1999948
134 1999910
153 1999895
172 1999874
191 1999866
202 1999861
205 1999821
233 1999801
248 1999757
275 1999747
325 1999745
430 1999727
436 1999703
457 1999684
469 1999680
474 1999643
501 1999636
508 1999626
599 1999601
636 1999597
641 1999519
657 1999512
669 1999505
...

output:

4012897019829
4006387348128
4003310331640
4012897019829
4007571411624
4012897019829
4012897019829
4013532935280
4013532935280
4012897019829
4012897019829
4007571411624
4007774342745
4012897019829
4005941765606
4013532935280
4005212993100
4013532935280
4012897019829
4000965234310
4013532935280
401353...

result:

ok 99999 lines

Test #53:

score: 0
Accepted
time: 85ms
memory: 14244kb

input:

100000 100000
3082 999997232
17241 999988770
21287 999983397
22453 999980469
26999 999971002
53048 999967543
58812 999961887
71407 999959414
74918 999950522
90203 999943505
99785 999929362
106646 999904057
114474 999903106
116778 999900566
119744 999870595
134181 999847273
140114 999808039
149620 99...

output:

998784411056729601
1002312056479256300
1000813258376503440
1002312056479256300
1002312056479256300
1002312056479256300
1002834788680426296
1000047922256042033
1002312056479256300
1002312056479256300
1002834788680426296
1002777061715905704
1000047922256042033
1002644578556115040
1002644578556115040
1...

result:

ok 99999 lines

Test #54:

score: 0
Accepted
time: 87ms
memory: 14164kb

input:

100000 100000
10 1999990
11 1999976
59 1999966
84 1999950
87 1999892
109 1999891
128 1999850
141 1999848
186 1999831
236 1999825
246 1999821
254 1999802
272 1999789
285 1999764
319 1999757
326 1999671
334 1999654
363 1999608
366 1999606
382 1999589
422 1999532
481 1999491
487 1999475
493 1999472
521...

output:

4005049448500
4018253411536
4011362642320
4018253411536
4003498802862
4013059882532
4004403154069
4005938324201
4005049448500
4007205774657
4009090733445
4005049448500
4018253411536
4007395351168
4005049448500
3995559195768
4005049448500
4001055367958
4005049448500
4004411297340
4005049448500
401825...

result:

ok 99999 lines

Test #55:

score: 0
Accepted
time: 86ms
memory: 14244kb

input:

100000 100000
10437 999995374
22392 999991665
25777 999962694
33329 999941432
42929 999928254
56167 999924028
59300 999901598
60214 999840742
61577 999827846
90352 999823787
97993 999823563
105186 999819350
106270 999819255
131840 999812201
132550 999799755
133187 999773901
134220 999757870
148966 9...

output:

998141986473126540
1002280636462099418
1002280636462099418
1002280636462099418
997044797765599128
1002022299674458348
1002022299674458348
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
1002280636462099418
10...

result:

ok 99999 lines

Test #56:

score: 0
Accepted
time: 92ms
memory: 14356kb

input:

100000 100000
1 1599985
14 1599969
27 1599953
40 1599937
53 1599921
66 1599905
79 1599889
92 1599873
105 1599857
118 1599841
131 1599825
144 1599809
157 1599793
170 1599777
183 1599761
196 1599745
209 1599729
222 1599713
235 1599697
248 1599681
261 1599665
274 1599649
287 1599633
300 1599617
313 159...

output:

2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
2079964200154
207996...

result:

ok 100000 lines

Test #57:

score: 0
Accepted
time: 73ms
memory: 14248kb

input:

100000 100000
1 3199969
14 3199937
27 3199905
40 3199873
53 3199841
66 3199809
79 3199777
92 3199745
105 3199713
118 3199681
131 3199649
144 3199617
157 3199585
170 3199553
183 3199521
196 3199489
209 3199457
222 3199425
235 3199393
248 3199361
261 3199329
274 3199297
287 3199265
300 3199233
313 319...

output:

4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
4159925800330
415992...

result:

ok 100000 lines

Test #58:

score: 0
Accepted
time: 83ms
memory: 14312kb

input:

100000 100000
1 3199969
27 3199937
53 3199905
79 3199873
105 3199841
131 3199809
157 3199777
183 3199745
209 3199713
235 3199681
261 3199649
287 3199617
313 3199585
339 3199553
365 3199521
391 3199489
417 3199457
443 3199425
469 3199393
495 3199361
521 3199329
547 3199297
573 3199265
599 3199233
625...

output:

8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
8319845200720
831984...

result:

ok 100000 lines

Test #59:

score: 0
Accepted
time: 76ms
memory: 14244kb

input:

100000 100000
1 715092850
9272 715085699
18543 715078548
27814 715071397
37085 715064246
46356 715057095
55627 715049944
64898 715042793
74169 715035642
83440 715028491
92711 715021340
101982 715014189
111253 715007038
120524 714999887
129795 714992736
139066 714985585
148337 714978434
157608 714971...

output:

662955953966464081
662955953966464081
662955953966464081
662955953966464081
662955953966464081
662955955608647664
662955955608647664
662955955608647664
662955955608647664
662955953966464081
662955955608647664
662955955608647664
662955953966464081
662955953966464081
662955955608647664
662955955608647...

result:

ok 100000 lines

Test #60:

score: 0
Accepted
time: 72ms
memory: 14148kb

input:

100000 100000
1 211297888
1173 211295775
2345 211293662
3517 211291549
4689 211289436
5861 211287323
7033 211285210
8205 211283097
9377 211280984
10549 211278871
11721 211276758
12893 211274645
14065 211272532
15237 211270419
16409 211268306
17581 211266193
18753 211264080
19925 211261967
21097 2112...

output:

24763865700766590
24763865372269870
24763865372269870
24763865700766590
24763865372269870
24763865372269870
24763865700766590
24763865700766590
24763865700766590
24763865700766590
24763865372269870
24763865372269870
24763865372269870
24763865372269870
24763865372269870
24763865372269870
247638653722...

result:

ok 100000 lines

Test #61:

score: 0
Accepted
time: 83ms
memory: 14120kb

input:

100000 100000
9101 410508609
12444 410503952
14708 410501333
23815 410495283
31966 410492662
33809 410487701
39620 410484687
47262 410482212
48807 410473605
54936 410465123
64335 410458798
71431 410456582
79242 410448919
84291 410441792
89905 410437918
97403 410429611
100484 410419880
102182 4104166...

output:

171614682779638629
165001801893608298
165792155122292985
171162071882531446
170915943402020740
165001801893608298
165455199578549160
171614682779638629
171614682779638629
171614682779638629
169694727412496916
171614682779638629
163502727776033967
165713659712341765
170521333115860440
164315459161179...

result:

ok 100000 lines

Test #62:

score: 0
Accepted
time: 80ms
memory: 14116kb

input:

100000 100000
1179 403868768
2121 403861247
8416 403851845
13120 403843212
16941 403842981
17956 403838607
21697 403832716
26855 403827263
33729 403819447
37998 403810496
38612 403806361
40275 403802664
42672 403796825
45327 403796754
46029 403792435
50990 403785046
51048 403775870
55051 403769967
5...

output:

122597128639185508
122597128639185508
139785367512920096
125434687907823564
136383898876992360
123657103257503349
123487393481542496
147732193760272433
141817575125298642
141817575125298642
122597128639185508
141817575125298642
121468455962306886
156078388086892080
123142186577202224
129347424832750...

result:

ok 100000 lines

Test #63:

score: 0
Accepted
time: 75ms
memory: 14172kb

input:

100000 100000
317 369909977
429 369909160
846 369907352
1145 369904071
1364 369903991
1572 369901131
1977 369900666
2403 369897648
2757 369896884
3149 369895385
3540 369894260
4010 369891257
4127 369888641
4165 369886788
4598 369884140
4759 369881167
5144 369878813
5314 369876411
5681 369874656
6130...

output:

69136009232373936
63467962975099215
69161655616087590
69183612617987456
68862580549709325
67515087233213895
65035555686719568
64868897737213440
64911476855648117
66750986191780740
69183612617987456
65035555686719568
65035555686719568
68869341715065955
67532828230993226
65035555686719568
619016154389...

result:

ok 100000 lines

Test #64:

score: 0
Accepted
time: 86ms
memory: 14172kb

input:

100000 100000
803 13953708
1520 13953405
2085 13953121
2377 13953090
2444 13952841
3028 13952801
3981 13952497
4113 13952345
4171 13952316
4419 13952239
5008 13951963
5267 13951853
6164 13951632
6816 13951504
7083 13951355
7727 13951101
8193 13951025
8742 13950991
9291 13950699
9667 13950430
9714 13...

output:

337882653291160
374421115534744
317601827719769
374421115534744
286768359462231
374421115534744
374421115534744
374421115534744
322683855081910
374421115534744
337882653291160
294061771691192
324207651985506
306321311078848
374421115534744
337882653291160
337882653291160
207171245400435
283942706188...

result:

ok 100000 lines

Subtask #4:

score: 0
Wrong Answer

Test #65:

score: 0
Wrong Answer
time: 52ms
memory: 8608kb

input:

200 100000
2904660 993940483
16886371 993289642
17317405 990982034
18403947 976774733
18849359 973351068
19183185 970254940
19306003 966229683
21192298 964806508
23734314 964320708
23888967 955733824
27113148 951453312
37031360 944529530
39266197 937051115
40090929 928931574
59651306 922916360
69712...

output:

1072358872157791815
1050815141195856939
1050815141195856939
1072358872157791815
1048949094301390997
1048855143474647820
1072358872157791815
1072358872157791815
1072358872157791815
1053378927900096121
1072358872157791815
1072358872157791815
1072358872157791815
1067417078192353174
1072358872157791815
...

result:

wrong answer 1st lines differ - expected: '1016308928382908236', found: '1072358872157791815'

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%