QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#515042#2270. LCM of GCDsAnotherDayofSun#AC ✓106ms15648kbC++203.2kb2024-08-11 14:44:022024-08-11 14:44:02

Judging History

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

  • [2024-08-11 14:44:02]
  • 评测
  • 测评结果:AC
  • 用时:106ms
  • 内存:15648kb
  • [2024-08-11 14:44:02]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define re 
#define N 300005

using namespace std;
int n,m,K,q,T;
inline void Rd(int &res){
	re char c;res=0;
	while(c=getchar(),c<48);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
}
inline void Rd(ll &res){
	re char c;res=0;
	while(c=getchar(),c<48);
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>47);
}
ll gcd(ll a,ll b){return (!b)?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll a[N];
struct node{
	ll v0,v1,v2;
}tree[N<<2];
void Up(int p,int l,int r){
	int mid=(l+r)>>1;
	tree[p].v0=gcd(tree[p<<1].v0,tree[p<<1|1].v0);
	int len1=mid-l+1,len2=r-mid;
	
	ll res=1;
	if(len1==1)res=lcm(res,tree[p<<1|1].v0);
	else res=lcm(res,gcd(tree[p<<1].v1,tree[p<<1|1].v0));
	
	if(len2==1)res=lcm(res,tree[p<<1].v0);
	else res=lcm(res,gcd(tree[p<<1].v0,tree[p<<1|1].v1));
	tree[p].v1=res;
	
	
	res=1;
	if(len1==2)res=lcm(res,tree[p<<1|1].v0);
	else if(len1>1)res=lcm(res,gcd(tree[p<<1].v2,tree[p<<1|1].v0));
	
	if(len2==2)res=lcm(res,tree[p<<1].v0);
	else if(len2>2)res=lcm(res,gcd(tree[p<<1].v0,tree[p<<1|1].v2));
	
	if(len1==1&&len2>1)res=lcm(res,tree[p<<1|1].v1);
	else if(len1>1&&len2==1)res=lcm(res,tree[p<<1].v1);
	else if(len1>1&&len2>1)res=lcm(res,gcd(tree[p<<1].v1,tree[p<<1|1].v1));
	tree[p].v2=res;
	
	
}
node Up(node a,node b,int len1,int len2){
	node now;
	now.v0=gcd(a.v0,b.v0);

	ll res=1;
	if(len1==1)res=lcm(res,b.v0);
	else res=lcm(res,gcd(a.v1,b.v0));
	
	if(len2==1)res=lcm(res,a.v0);
	else res=lcm(res,gcd(a.v0,b.v1));
	now.v1=res;
	
	
	res=1;
	if(len1==2)res=lcm(res,b.v0);
	else if(len1>2)res=lcm(res,gcd(a.v2,b.v0));
	
	if(len2==2)res=lcm(res,a.v0);
	else if(len2>2)res=lcm(res,gcd(a.v0,b.v2));
	
	if(len1==1&&len2>1)res=lcm(res,b.v1);
	else if(len1>1&&len2==1)res=lcm(res,a.v1);
	else if(len1>1&&len2>1)res=lcm(res,gcd(a.v1,b.v1));
	now.v2=res;
	
	return now;
}
void Build(int l,int r,int p){
	if(l==r){
		tree[p].v0=a[l];
		tree[p].v1=1;
		tree[p].v2=1;
		return;
	}
	int mid=(l+r)>>1;
	Build(l,mid,p<<1);
	Build(mid+1,r,p<<1|1);
	Up(p,l,r);
}
void update(int l,int r,int x,ll v,int p){
	if(l==r){
		tree[p].v0=v;
		tree[p].v1=0;
		tree[p].v2=0;
		return;
	}
	int mid=(l+r)>>1;
	if(x<=mid)update(l,mid,x,v,p<<1);
	else update(mid+1,r,x,v,p<<1|1);
	Up(p,l,r);
}
node query(int l,int r,int L,int R,int p){
	if(l==L&&r==R)return tree[p];
	int mid=(l+r)>>1;
	if(R<=mid)return query(l,mid,L,R,p<<1);
	else if(L>mid)return query(mid+1,r,L,R,p<<1|1);
	else{
		node now1=query(l,mid,L,mid,p<<1);
		node now2=query(mid+1,r,mid+1,R,p<<1|1);
		node now=Up(now1,now2,mid-L+1,R-mid);
		return now;
	}
	
}
int main(){
	Rd(n);Rd(m);
	for(int i=1;i<=n;i++)Rd(a[i]);
	Build(1,n,1);
	while(m--){
		char ch;
		while(ch=getchar(),ch<'A');
		if(ch=='Q'){
			int l,r,k;
			Rd(l),Rd(r),Rd(k);
			node now=query(1,n,l,r,1);
			if(k==0)printf("%lld\n",now.v0);
			else if(k==1)printf("%lld\n",now.v1);
			else printf("%lld\n",now.v2);
		}
		else{
			int x;
			ll v;
			Rd(x);Rd(v);
			update(1,n,x,v,1);
			
		}
		
		
		
	}
	
	
	
	
	
	return 0;
}
/*

 5 10
 12 10 16 28 15
 Q 1 3 1
 Q 3 4 0
 Q 2 2 0
 Q 2 5 2
 U 3 21
 Q 1 3 1
 Q 2 4 1
 Q 3 5 1
 Q 4 4 0
 Q 2 5 2
 
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 10
12 10 16 28 15
Q 1 3 1
Q 3 4 0
Q 2 2 0
Q 2 5 2
U 3 21
Q 1 3 1
Q 2 4 1
Q 3 5 1
Q 4 4 0
Q 2 5 2

output:

4
4
10
20
6
14
21
28
210

result:

ok 9 lines

Test #2:

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

input:

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

output:

1
1
1
6
2
1
1
1
1
6

result:

ok 10 lines

Test #3:

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

input:

99417 100000
997410 720487 932768 115 128154 302401 999266 146789 236143 92360 396671 186303 387999 345639 669897 396857 935750 538939 846502 419289 313345 685374 524667 204499 443553 878316 229629 27394 534535 670619 914168 417399 457308 558816 430796 140419 939340 198147 778565 800925 716132 96848...

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 100000 lines

Test #4:

score: 0
Accepted
time: 45ms
memory: 12232kb

input:

99436 100000
185124 25933 931751 549787 947945 435421 484859 420463 320609 330410 154462 204695 699021 619411 119978 299723 485286 266888 632881 621274 818412 529262 683180 134611 498674 513694 586930 184482 719917 785513 258557 854168 546331 494349 407400 846753 177025 79664 969851 505360 297086 65...

output:

1
2
1
1
1
1
3
1
56300
1
12384699284
1
1337543592
161063
1
2
3
448477444200
1
44550
1
2
1
3
1
1
1
1
1
1
1
2
1
1
1
2
299267391095190
1
1
307267
3
803685
1
5
1
1
2
3
3
2
1
287211
1
655508
1
1
1
2
20
3
1
2
1
1
580803
1
1
4
835458
2
1
353019
1
1
1
2
30817594836
1
575704
215909
1
1
1
809644
1
1
1
2
1
1
1
...

result:

ok 100000 lines

Test #5:

score: 0
Accepted
time: 52ms
memory: 12928kb

input:

100000 100000
185124 25933 931751 549787 947945 435421 484859 420463 320609 330410 154462 204695 699021 619411 119978 299723 485286 266888 632881 621274 818412 529262 683180 134611 498674 513694 586930 184482 719917 785513 258557 854168 546331 494349 407400 846753 177025 79664 969851 505360 297086 6...

output:

2
2
1
2
1
3
1
1
728441
1
75032825160
1
62521619383862340
1
2
1
1
1
1
1
1
1
1
61512528819
1
125341410605929740
1
9
1
1
964890
1
2
74020
1
1
1
1
2
758166
1
1
1
1
858585
2666536944364800
1
340525
1
2
1
1
1
1
1
2
1
1
191665267830
503005
281993
45
3
2
17096779026
1
1
3
1
1
583882
1
1
1
1
1
1
1
1
1
1
7974...

result:

ok 100000 lines

Test #6:

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

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
426
382
2
34
5882
2
2
2
2
2
2
2
479302
842
158
382
2
2
2
2
2
2
2
2
2
2
158
2
2
2
2
2
142
175222
1306
2
1574
2
2
2
554
2
2
6
2
2
2
2
2
13694
2
2
556154
2
64786
2
2
74
86
2
2
202
2
2
2
2
2
2
422338
2
479326
2
218
2
2
2
2
2
2
2
762946
2
197342
2
2
2
333182
2
762946
2
454042
93458
2
2
1354
2
2
4...

result:

ok 100000 lines

Test #7:

score: 0
Accepted
time: 70ms
memory: 12160kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

12
12
12
12
12
12
12
12
12
12
12
12
12
12
24204
12
12
12
3972
45516
12
12
12
12
12
12
12
12756
12
12
12
4596
1572
12
13116
12
12
12
12
13164
12
12
28092
12
12
12
12
38244
12
12
12
12
12
12
12
39612
4764
12
12
12
12
12
12
12
12
12
50628
12
15468
12
508812
12
12
12
12
12
12
12
17412
12
12
12
14172
12
...

result:

ok 100000 lines

Test #8:

score: 0
Accepted
time: 84ms
memory: 13388kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
426
382
2
34
5882
2
2
2
2
2
2
2
479302
842
158
382
2
2
2
2
2
2
2
2
2
2
158
2
2
2
2
2
142
175222
1306
2
1574
2
2
2
554
2
2
6
2
2
2
2
2
13694
2
2
556154
2
64786
2
2
74
86
2
2
202
2
2
2
2
2
2
422338
2
479326
2
218
2
2
2
2
2
2
2
762946
2
197342
2
2
2
333182
2
762946
2
454042
93458
2
2
1354
2
2
4...

result:

ok 100000 lines

Test #9:

score: 0
Accepted
time: 67ms
memory: 12372kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

12
12
12
12
12
12
12
12
12
12
12
12
12
12
24204
12
12
12
3972
45516
12
12
12
12
12
12
12
12756
12
12
12
4596
1572
12
13116
12
12
12
12
13164
12
12
28092
12
12
12
12
38244
12
12
12
12
12
12
12
39612
4764
12
12
12
12
12
12
12
12
12
50628
12
15468
12
508812
12
12
12
12
12
12
12
17412
12
12
12
14172
12
...

result:

ok 100000 lines

Test #10:

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

input:

100000 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 977...

output:

218
2
2
2
2
2
2
2
762946
2
197342
2
2
2
333182
2
762946
2
454042
93458
2
2
1354
2
2
4354
2
2
2558
2
1574
2
526
1018
2
226
2
2
2
118
2
2
2
2
2
2
2
2
2
626
153946
2
93458
2
2
794
11546
2
158
2
1322
118
2
2
2
2
982
122
2
158
2
146294
502
2
2
2
838
22618
2
1018
2
2
2
2
53926
2
2
458
2
2
2
2
2
2
2
2
2
85...

result:

ok 100000 lines

Test #11:

score: 0
Accepted
time: 103ms
memory: 12228kb

input:

99417 100000
997410 720487 932768 115 128154 302401 999266 146789 236143 92360 396671 186303 387999 345639 669897 396857 935750 538939 846502 419289 313345 685374 524667 204499 443553 878316 229629 27394 534535 670619 914168 417399 457308 558816 430796 140419 939340 198147 778565 800925 716132 96848...

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 49799 lines

Test #12:

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

input:

99436 100000
185124 25933 931751 549787 947945 435421 484859 420463 320609 330410 154462 204695 699021 619411 119978 299723 485286 266888 632881 621274 818412 529262 683180 134611 498674 513694 586930 184482 719917 785513 258557 854168 546331 494349 407400 846753 177025 79664 969851 505360 297086 65...

output:

6
258
12384699284
344018
1
44550
13848458974641174
1
1
1
4572790943490
299267391095190
6
8636785118672876
2
34
1
1
2
1
1
544978
853362
1
1
1
1
1
4
1
513598
332181952920
1
903676
12
13914317985
1
502144
1
1
1
1
1
2
120148896790
890966
2044698528
816600
2
147307
500355991408
1
1
1
1
453027
5866
2
3719...

result:

ok 50057 lines

Test #13:

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

input:

100000 100000
185124 25933 931751 549787 947945 435421 484859 420463 320609 330410 154462 204695 699021 619411 119978 299723 485286 266888 632881 621274 818412 529262 683180 134611 498674 513694 586930 184482 719917 785513 258557 854168 546331 494349 407400 846753 177025 79664 969851 505360 297086 6...

output:

785467
573087
1
1
1
62521619383862340
514727
1
1
3
1
9
2
65
2
3
11235114372
1
1
1
340525
650875
120364
1
110908477869339818
1
2
1
1
3
1
62
1
1
1
1
2
1
351012042060
101201
8
2
59212
1
12
2
1
4
2
1
410187570878
573546
4
1
749198
1
1
1
1
1
173112341009520
2
1
529205718520040784
2
1
173566
984723
1
1
1
...

result:

ok 50064 lines

Test #14:

score: 0
Accepted
time: 95ms
memory: 12788kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
2
158
2
2
2
2
2
2
2
74
2
2
2
2
2
2
2
2
2
2
2
401266
2
746
2
218
326
1
1
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
1
994078
1286
2
2
2
2
2
2
2
2
2
2
2
194
2
2
1
1
2
2
1154
2
1
2234
866
778
2
866
2
2
662
2
2
1
554
1
2
2
2
2
1
2
1
1
1
746
2
2
2
2
1
2
580462
2
2
687998
758...

result:

ok 49936 lines

Test #15:

score: 0
Accepted
time: 98ms
memory: 12844kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

28572
12
12
12
12
12
12
12
12
12
2724
12
12
12
12
12
45852
12
12
12
12
12
12
12
12
3396
4
12
12
50628
12
12
12
12
12
12
12
12
3156
12
14052
12
12
12
94596
12
12
12
12
12
12
12
5196
12
12
12
12
8868
12
12
12
12
12
12
12
12
12
31404
12
12
11796
12
12
12
276996
12
5484
12
12
12
12
12
12
12
12
12
12
12
...

result:

ok 50076 lines

Test #16:

score: 0
Accepted
time: 99ms
memory: 13420kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
2
158
2
2
2
2
2
2
2
74
2
2
2
2
2
2
2
2
2
2
2
401266
2
746
2
218
326
1
1
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
1
994078
1286
2
2
2
2
2
2
2
2
2
2
2
194
2
2
1
1
2
2
1154
2
1
2234
866
778
2
866
2
2
662
2
2
1
554
1
2
2
2
2
1
2
1
1
1
746
2
2
2
2
1
2
580462
2
2
687998
758...

result:

ok 49936 lines

Test #17:

score: 0
Accepted
time: 97ms
memory: 13348kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

28572
12
12
12
12
12
12
12
12
12
2724
12
12
12
12
12
45852
12
12
12
12
12
12
12
12
3396
4
12
12
50628
12
12
12
12
12
12
12
12
3156
12
14052
12
12
12
94596
12
12
12
12
12
12
12
5196
12
12
12
12
8868
12
12
12
12
12
12
12
12
12
31404
12
12
11796
12
12
12
276996
12
5484
12
12
12
12
12
12
12
12
12
12
12
...

result:

ok 50076 lines

Test #18:

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

input:

100000 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 977...

output:

2
2
2
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
2
994078
1286
2
2
2
2
2
2
2
2
2
2
118
194
2
2
2
2
2
2
1154
2
1
64786
866
778
2
866
2
2
662
2
2
2
554
2
2
1202
2
2
2
2
1
82
2
746
2
2
2
538
1
2
580462
2
2
687998
758
2
2
1
34946
1
756526
2
123542
2
718
2
2
2
2
2
6
2
2
3398
599798
...

result:

ok 49940 lines

Test #19:

score: 0
Accepted
time: 98ms
memory: 14292kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
2
158
2
2
2
2
2
2
2
74
1306
2
2
2
2
2
2
2
2
2
2
401266
2
746
2
218
326
82
2
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
2
994078
1286
2
2
2
2
2
2
2
2
2
2
118
194
2
2
2
2
2
2
1154
2
2
64786
866
778
2
866
2
2
662
2
2
2
554
2
2
2
626
2
2
2
2
82
2
746
2
922
2
538
2
2
580462
...

result:

ok 49928 lines

Test #20:

score: 0
Accepted
time: 96ms
memory: 12348kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

28572
12
12
12
12
12
12
12
12
12
2724
12
12
12
12
12
45852
12
12
12
12
12
12
12
12
3396
12
12
12
50628
12
12
12
12
12
12
12
12
3156
12
14052
12
12
12
94596
12
12
12
12
12
12
12
5196
12
12
12
12
8868
12
12
12
12
12
12
12
12
12
31404
12
12
11796
12
12
12
276996
12
5484
12
12
12
12
12
12
12
12
12
12
12...

result:

ok 50082 lines

Test #21:

score: 0
Accepted
time: 90ms
memory: 14224kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
2
2
2
2
158
2
2
2
2
2
2
2
74
1306
2
2
2
2
2
2
2
2
2
2
401266
2
746
2
218
326
82
2
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
2
994078
1286
2
2
2
2
2
2
2
2
2
2
118
194
2
2
2
2
2
2
1154
2
2
64786
866
778
2
866
2
2
662
2
2
2
554
2
2
2
626
2
2
2
2
82
2
746
2
922
2
538
2
2
580462
...

result:

ok 49928 lines

Test #22:

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

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

28572
12
12
12
12
12
12
12
12
12
2724
12
12
12
12
12
45852
12
12
12
12
12
12
12
12
3396
12
12
12
50628
12
12
12
12
12
12
12
12
3156
12
14052
12
12
12
94596
12
12
12
12
12
12
12
5196
12
12
12
12
8868
12
12
12
12
12
12
12
12
12
31404
12
12
11796
12
12
12
276996
12
5484
12
12
12
12
12
12
12
12
12
12
12...

result:

ok 50082 lines

Test #23:

score: 0
Accepted
time: 97ms
memory: 12284kb

input:

100000 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 977...

output:

2
2
2
166
2
2
14
2
2
2
22
2
122
2
2
2
158
2
1094
2
2
32482
394
626
2
2
2
994078
1286
2
2
2
2
2
2
2
2
2
2
118
194
2
2
2
2
2
2
1154
2
2
64786
866
778
2
866
2
2
662
2
2
2
554
2
2
1202
626
2
2
2
2
82
2
746
2
922
2
538
2
2
580462
2
2
687998
758
2
146
2
34946
2
756526
2
123542
2
718
2
2
2
2
2
6
2
2
3398
5...

result:

ok 49932 lines

Test #24:

score: 0
Accepted
time: 99ms
memory: 12900kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
34
2
643718
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1306
2
2
2
1
2
2
2
1
2
746
2
2
2
2
2
2
166
2
458
2
2
2
22
2
122
2
2
2
226
13462
2
2
2
2
46
1
2
2
2
554
2
794
2
1018
2
2
118
458
2
2
1762
2
5744
2
2
2
2
866
2026
2
2
866
2
2
662
2
2
1
2
2
1642
2
1
2
2
450962
11842
698
2
28542
2
2
283282
326
825262
2
2
2
2...

result:

ok 49730 lines

Test #25:

score: 0
Accepted
time: 103ms
memory: 13544kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

12
5172
12
12
12
12
45516
12
12
2388
24
4596
12
45852
12
12
12
12
38244
12
39612
12
12
12
12
12
25332
17124
12
12
12
12
1788
12
12
14052
12
12
12
20652
12
12
945960
12
12
5196
12
12
12
12
17868
12
12
12
12
12
12
12
12
12
31404
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
353172
40116
12
12
...

result:

ok 50113 lines

Test #26:

score: 0
Accepted
time: 96ms
memory: 12376kb

input:

99772 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 9776...

output:

2
34
2
643718
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1306
2
2
2
1
2
2
2
1
2
746
2
2
2
2
2
2
166
2
458
2
2
2
22
2
122
2
2
2
226
13462
2
2
2
2
46
1
2
2
2
554
2
794
2
1018
2
2
118
458
2
2
1762
2
5744
2
2
2
2
866
2026
2
2
866
2
2
662
2
2
1
2
2
1642
2
1
2
2
450962
11842
698
2
28542
2
2
283282
326
825262
2
2
2
2...

result:

ok 49730 lines

Test #27:

score: 0
Accepted
time: 98ms
memory: 12220kb

input:

99772 100000
799728 156672 461820 979236 278580 686628 736920 456348 738312 340620 47100 592356 891840 982524 929844 585996 695892 976536 798492 182172 566772 136008 86376 587796 535200 737472 409500 992256 648276 520632 432972 536376 664608 777468 658032 297624 254232 379464 537852 374196 842484 22...

output:

12
5172
12
12
12
12
45516
12
12
2388
24
4596
12
45852
12
12
12
12
38244
12
39612
12
12
12
12
12
25332
17124
12
12
12
12
1788
12
12
14052
12
12
12
20652
12
12
945960
12
12
5196
12
12
12
12
17868
12
12
12
12
12
12
12
12
12
31404
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
353172
40116
12
12
...

result:

ok 50113 lines

Test #28:

score: 0
Accepted
time: 106ms
memory: 14360kb

input:

100000 100000
67522 810426 959176 794398 778802 983478 906982 988840 251298 912378 503494 597514 743684 917932 210788 629856 167446 484766 327640 762840 630602 310996 405312 427858 101598 68298 227192 8948 127810 811452 414984 812970 345514 105980 767572 810146 942472 555648 125578 515618 124202 977...

output:

2
2
2
2
2
166
2
458
2
2
2
22
2
122
2
2
2
226
13462
2
2
2
2
46
2
2
2
2
554
2
794
2
1018
2
2
118
458
2
2
1762
2
1436
2
2
2
2
866
2026
2
2
866
2
2
662
2
2
2
2
2
1642
2
1
2
2
450962
11842
698
2
28542
2
2
283282
326
825262
2
2
2
2
1844
2
2
1
2
2
2
2
6
2
2
2
1838
2
1286
1354
2
2
2
2
1
1
2
1
93458
1
2
2
2
...

result:

ok 49705 lines