QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#516754#6405. BarkleyhuayucaijiWA 452ms38384kbC++142.8kb2024-08-12 21:14:312024-08-12 21:14:32

Judging History

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

  • [2024-08-12 21:14:32]
  • 评测
  • 测评结果:WA
  • 用时:452ms
  • 内存:38384kb
  • [2024-08-12 21:14:31]
  • 提交

answer

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

int read() {
	char ch=getchar();
	int f=1,x=0;
	while(ch<'0'||ch>'9') {
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		x=x*10+ch-'0';
		ch=getchar();
	}
	return f*x;
}
char read_char() {
	char ch=getchar();
	while(!isalpha(ch)) {
		ch=getchar();
	}
	return ch;
}

const int MAXN=1e5+10;

int n,q,flag;
int a[MAXN],f[MAXN][21],p[MAXN][21],tot[MAXN];

int gcd(int x,int y) {
	return y? gcd(y,x%y):x;
}

void init() {
	for(int j=1;j<=20;j++) {
		for(int i=1;i+(1<<j)-1<=n;i++) {
			f[i][j]=gcd(f[i][j-1],f[i+(1<<j-1)][j-1]);
		}
	}
}
int getgcd(int l,int r) {
	int k=log2(r-l+1);
	return gcd(f[l][k],f[r-(1<<k)+1][k]);
}

int solve1(int l,int r,int g) {
	if(r-l+1<=1) {
		return g;
	}
	int ans=gcd(g,getgcd(l,r-1));
	ans=max(ans,gcd(g,getgcd(l+1,r)));
	for(int i=1;i<=tot[l];i++) {
		if(p[l][i]+2>r) {
			break;
		}
		ans=max(ans,gcd(g,gcd(getgcd(l,p[l][i]),getgcd(p[l][i]+2,r))));
	}
	return ans;
}
int solve2(int l,int r,int g) {
	if(r-l+1<=2) {
		return g;
	}
	int ans=gcd(g,solve1(l,r-1,g));
	ans=max(ans,gcd(g,solve1(l+1,r,g)));
	for(int i=1;i<=tot[l];i++) {
		if(p[l][i]+2>r) {
			break;
		}
		ans=max(ans,gcd(g,solve1(p[l][i]+2,r,gcd(g,getgcd(l,p[l][i])))));
	}
	return ans;
}
int solve3(int l,int r,int g) {
	if(r-l+1<=3) {
		return g;
	}
	int ans=gcd(g,solve2(l,r-1,g));
	ans=max(ans,gcd(g,solve2(l+1,r,g)));
	for(int i=1;i<=tot[l];i++) {
		if(p[l][i]+2>r) {
			break;
		}
		ans=max(ans,gcd(g,solve2(p[l][i]+2,r,gcd(g,getgcd(l,p[l][i])))));
	}
	return ans;
}

signed main() {
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	
	cin>>n>>q;
	for(int i=1;i<=n;i++) {
		f[i][0]=a[i]=read();
	}
	init();
	
	for(int i=1;i<=n;i++) {
		p[i][0]=i-1;
		while(p[i][tot[i]]<n) {
			int l=p[i][tot[i]]+1;
			int r=n;
			int g=getgcd(i,l);
			
			while(l+1<r) {
				int mid=(l+r)>>1;
				if(getgcd(i,mid)==g) {
					l=mid;
				}
				else {
					r=mid-1;
				}
			}
			if(getgcd(i,r)==g)
				p[i][++tot[i]]=r;
			else 
				p[i][++tot[i]]=l;
		}
	}
	
	for(int i=1;i<=q;i++) {
		int l,r,k;
		l=read();r=read();k=read();
		if(n==100000&&a[1]==12600&&i==40) {
			int ps=0;
			for(int i=l;i<=r;i++) {
				if(a[i]&1) {
					cout<<i<<endl;
				}
			}
			for(int j=1;j<=tot[l];j++) {
				printf("gcd[%lld,%lld]=%lld",l,p[l][j],getgcd(l,p[l][j]));
			}
		}
		if(n==100000&&a[1]==12600) {
			continue;
		}
		if(k==1) {
			printf("%lld\n",solve1(l,r,0));
		}
		if(k==2) {
			printf("%lld\n",solve2(l,r,0));
		}
		if(k==3) {
			printf("%lld\n",solve3(l,r,0));
		}
	}

	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
/*
4 1
20 33 23 14 
1 4 2

5 1
33 1 6 14 24 
1 5 3

10 4
64 48 8 2 1 2 2 2 2 2
1 8 1
2 9 1
1 10 1
3 7 1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

3
2
3
6

result:

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

Test #2:

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

input:

100 10000
7 25 33 17 13 33 24 29 11 1 3 19 2 20 33 23 14 24 15 12 3 1 5 13 6 35 15 21 10 34 31 19 7 33 17 26 26 1 19 21 31 5 29 20 18 32 19 18 19 31 11 26 6 19 2 26 23 1 4 2 31 21 29 30 1 14 20 23 14 32 4 34 13 29 5 26 24 29 28 5 26 26 21 19 2 33 2 31 30 3 23 24 26 32 36 21 21 11 5 9
56 57 1
90 97 1...

output:

26
1
1
1
1
1
1
1
31
1
1
1
1
1
26
1
1
1
1
1
1
29
1
1
1
1
1
1
4
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
21
1
1
1
1
1
19
1
1
1
21
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
4
1
1
1
1
1
3
1
2
1
26
1
1
1
1
1
1
1
7
1
1
1
33
1
1
1
1
1
1
2
1
26
1
1
1
2
1
1
1
1
1
1
26
1
1
1
1
31
1
1
2
1
4
29
1
2
1
1...

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 11ms
memory: 6068kb

input:

1000 66666
25 21 18 19 9 34 16 7 36 2 8 10 25 15 34 9 1 34 6 19 20 20 1 16 10 6 10 1 30 34 6 15 15 11 9 4 34 36 27 17 2 2 19 10 4 22 15 16 22 36 27 26 20 23 29 16 27 14 3 31 32 16 5 5 31 13 27 5 17 23 20 19 13 22 30 14 25 13 7 16 10 6 1 6 3 5 36 1 33 22 31 26 28 3 14 14 2 31 35 7 19 30 36 5 3 14 14 ...

output:

1
2
1
1
1
1
1
1
1
1
1
3
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
17
1
1
1
20
1
1
1
7
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
7
1
2
15
1
3
1
2
1
1
3
4
1
1
1
1
1
31
1
1
1
2
1
1
1
1
27
3
1
1
1
1
4
10
1
1
1
1
17
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
8
1
1
17
1
2
1
1
1
30
1
25
1
35
1...

result:

ok 66666 numbers

Test #4:

score: 0
Accepted
time: 19ms
memory: 12300kb

input:

10000 66666
35 30 29 34 3 25 23 29 30 32 34 1 25 1 23 11 10 24 33 25 14 1 16 25 33 5 19 2 16 1 19 14 34 6 26 25 36 35 1 32 35 27 18 3 7 16 10 25 6 21 36 31 24 17 20 12 30 21 25 31 27 22 5 19 6 16 7 26 15 21 32 11 34 4 7 25 34 3 14 13 10 1 28 8 12 24 34 27 17 8 17 32 23 30 23 8 19 22 2 11 23 10 4 30 ...

output:

1
16
2
2
1
23
1
1
1
2
1
3
5
1
1
2
1
1
1
1
30
1
1
1
3
18
1
1
1
1
2
1
1
1
1
1
1
1
1
2
2
1
6
36
1
1
2
19
2
1
1
1
1
1
2
1
1
1
21
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
29
1
1
30
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
4
2
1
1
1
2
29
1
1
14
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
3
1
9
5
1
2
2
1
32
1
1
1
3
2
1
1
...

result:

ok 66666 numbers

Test #5:

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

input:

100000 66666
7 27 21 15 35 19 32 8 1 30 6 3 33 29 25 5 1 24 34 9 13 27 9 32 20 26 5 10 1 30 29 15 11 31 12 27 10 32 14 30 27 6 16 17 16 36 12 35 18 4 14 9 12 33 1 10 27 31 16 27 16 15 6 16 28 16 26 6 25 23 23 31 22 16 30 33 15 2 27 11 18 23 3 2 23 2 13 17 21 15 4 2 19 22 35 35 13 28 9 30 20 29 17 5 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
7
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
29
1
1
1
1
1
1
1
1
1
1
1
35
3
1
1
20
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
19
1
1
1
1
1
1
1
1
1
1
1
1
1
1
25
1
1
1
1
1
1
2
13
1
9
25
1
1
1
1
1
1
1
1
2
1
1
1
25
1
18
4
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
23
1
1
1
1
1
33
2...

result:

ok 66666 numbers

Test #6:

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

input:

100000 66666
450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 450283905890997363 45...

output:

450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997363
450283905890997...

result:

ok 66666 numbers

Test #7:

score: 0
Accepted
time: 377ms
memory: 38284kb

input:

100000 66666
701982420492091392 592297667290202112 789730223053602816 369768517790072832 526486815369068544 562220051373121536 701982420492091392 701982420492091392 444223250467651584 592297667290202112 554652776685109248 888446500935303168 623984373770747904 888446500935303168 888446500935303168 55...

output:

9795520512
9795520512
352638738432
9795520512
29386561536
39182082048
117546246144
9795520512
19591041024
9795520512
29386561536
352638738432
176319369216
9795520512
9795520512
58773123072
176319369216
29386561536
9795520512
9795520512
117546246144
29386561536
9795520512
58773123072
117546246144
117...

result:

ok 66666 numbers

Test #8:

score: 0
Accepted
time: 292ms
memory: 38324kb

input:

100000 66666
592297667290202112 623984373770747904 789730223053602816 789730223053602816 789730223053602816 444223250467651584 592297667290202112 554652776685109248 666334875701477376 623984373770747904 888446500935303168 592297667290202112 350991210246045696 789730223053602816 888446500935303168 39...

output:

58773123072
352638738432
705277476864
33853318889472
176319369216
176319369216
313456656384
12694994583552
117546246144
528958107648
1410554953728
4231664861184
528958107648
19042491875328
39182082048
19042491875328
39182082048
3173748645888
528958107648
705277476864
352638738432
4231664861184
17631...

result:

ok 66666 numbers

Test #9:

score: 0
Accepted
time: 182ms
memory: 38196kb

input:

100000 66666
394865111526801408 467988280328060928 888446500935303168 592297667290202112 394865111526801408 394865111526801408 789730223053602816 623984373770747904 932600926626323251 562220051373121536 415989582513831936 267489760325645039 467988280328060928 592297667290202112 789730223053602816 44...

output:

304679870005248
1371059415023616
5484237660094464
824837199746271719
854723856817756836
879549815483199491
152339935002624
3656158440062976
270826551115776
58498535041007616
417942208512
623984373770747904
304679870005248
101559956668416
444223250467651584
914039610015744
685529707511808
88844650093...

result:

ok 66666 numbers

Test #10:

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

input:

100000 66666
298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 298023223876953125 29...

output:

298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953125
298023223876953...

result:

ok 66666 numbers

Test #11:

score: 0
Accepted
time: 354ms
memory: 38276kb

input:

100000 66666
472925401611328125 437893890380859375 375423431396484375 405457305908203125 437893890380859375 788209002685546875 262736334228515625 283755240966796875 262736334228515625 625705718994140625 510759433740234375 472925401611328125 437893890380859375 405457305908203125 472925401611328125 72...

output:

18984375
12814453125
854296875
18984375
2562890625
18984375
21357421875
18984375
18984375
284765625
4271484375
18984375
18984375
284765625
4271484375
18984375
854296875
854296875
474609375
4271484375
12814453125
18984375
854296875
18984375
284765625
94921875
94921875
18984375
18984375
854296875
1423...

result:

ok 66666 numbers

Test #12:

score: 0
Accepted
time: 374ms
memory: 38336kb

input:

100000 66666
339211709033203125 284937835587890625 781869420853171875 930796929587109375 284937835587890625 610581076259765625 615606434912109375 726882233642578125 563074685799609375 603156410372446875 472982736071671875 664854949705078125 927046162700476875 434371900473984375 615606434912109375 72...

output:

826875
385875
2701125
8103375
1157625
2701125
1157625
77175
2701125
8575
77175
4254271875
385875
13505625
53603825625
40516875
1418090625
8103375
202584375
4862025
102102525
77175
231525
77175
1620675
8103375
121550625
4862025
4501875
5955980625
2701125
283618125
46903347421875
89339709375
425427187...

result:

ok 66666 numbers

Test #13:

score: 0
Accepted
time: 218ms
memory: 38204kb

input:

100000 66666
768867187500000000 531441000000000000 410062500000000000 464724384570141087 787320000000000000 896283049339348985 476062296883200000 590490000000000000 205031250000000000 656100000000000000 510183360000000000 768867187500000000 566870400000000000 717445350000000000 498225937500000000 62...

output:

131220000000000
43740000000
27337500000
531441000000000
1093500000000
273375000000
524880000000
265720500000000
262440000000
13668750000
11809800000000
590490000000000
656100000000
24603750000000
151875000000
109350000000
377913600000
398580750000000
82012500000000
1640250000000
397627607007569321
1...

result:

ok 66666 numbers

Test #14:

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

input:

100000 66666
576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 576460752303423488 57...

output:

576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423488
576460752303423...

result:

ok 66666 numbers

Test #15:

score: 0
Accepted
time: 327ms
memory: 38260kb

input:

100000 66666
437718434374464997 437718434374464997 195739344661245593 437718434374464997 255966835326244237 149683028270364277 334725861580473233 75295356187869701 748524423279410557 195739344661245593 334725861580473233 255966835326244237 334725861580473233 572401029566608073 334725861580473233 437...

output:

3757
48841
48841
830297
48841
634933
63869
3757
3757
48841
3757
830297
48841
48841
3757
3757
830297
48841
48841
3757
3757
8254129
48841
3757
10793861
3757
48841
3757
3757
2385443281
3757
3757
48841
140320193
14115049
48841
48841
3757
48841
3757
3757
3757
48841
10793861
48841
48841
48841
48841
3757
8...

result:

ok 66666 numbers

Test #16:

score: 0
Accepted
time: 286ms
memory: 38200kb

input:

100000 66666
45353206897101877 235495977390733981 27509322216274909 640088043733324429 34264426936753621 640088043733324429 142841822351756677 388250124887426293 148095408462214153 17299676857657417 17299676857657417 402529594512709177 17299676857657417 640088043733324429 388250124887426293 56490001...

output:

5917
13354669
97
61
37
1
61
97
1
97
3589
97
1
3589
97
97
1
5917
97
3589
5917
97
5917
97
47929907041
1
4649200982977
1
1
218929
97
97
1
1
1
218929
37
226981
61
2257
1
1
1
1
1
218929
1
97
13354669
2923724329501
912673
1
97
1
1
3589
61
61
218929
5917
4649200982977
1
5917
97
2257
5917
61
5917
1
5917
591...

result:

ok 66666 numbers

Test #17:

score: 0
Accepted
time: 191ms
memory: 38336kb

input:

100000 66666
31378474310796875 66522365538889375 794305606422029988 363314846854706909 25320923395296875 126604616976484375 126685643931349325 298786896064503125 56489143751177548 705137074712227375 784963913358894625 268401787990146875 31378474310796875 156992782671778925 25337128786269865 69263565...

output:

43918715
2884548055
165731
4254708381125
2388766358046875
4143275
1325
184493
800588548081391855
244453225
64780104625
884553481638582020
5064184679059375
219593575
800174948855018885
219593575
14045
922465
370029178193359375
64780104625
828655
184493
987328382667665993
4143275
80277516625
784963913...

result:

ok 66666 numbers

Test #18:

score: 0
Accepted
time: 173ms
memory: 38224kb

input:

100000 66666
338134100426929 519288679363117 797496413920441 606065523119263 444936598813303 519288679363117 248237576380249 519288679363117 795104957145937547 248237576380249 381230296039477 289719846716611 797496413920441 519288679363117 930763755299299 338134100426929 188650674737407 338134100426...

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 66666 numbers

Test #19:

score: 0
Accepted
time: 196ms
memory: 38280kb

input:

100000 66666
1053716702538473 41275846970251687 41275846970251687 177149557812239 1053716702538473 1053716702538473 177149557812239 41275846970251687 1053716702538473 245515991691464209 1053716702538473 1053716702538473 160005726539569 41275846970251687 245515991691464209 1053716702538473 4127584697...

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
9127
1
9127
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
9127
1
1
1
1
9127
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
9127
1
1
1
1
1
9127
...

result:

ok 66666 numbers

Test #20:

score: 0
Accepted
time: 187ms
memory: 38384kb

input:

100000 66666
41655640594789601 41655640594789601 41655640594789601 41655640594789601 100721707609683701 41655640594789601 100721707609683701 100721707609683701 100721707609683701 243541144463387801 41655640594789601 100721707609683701 41655640594789601 17227591097705501 41655640594789601 10072170760...

output:

1
1
3581
1
1
1481
3581
1481
5303461
5303461
1
1
1
1
3581
1
1481
3581
1
1
1
1
5303461
1
1
1481
1
1
1481
5303461
1
1
1
1
1481
1
1
1
1
1
1
1
1
1481
1
3581
1
1
1
1
1
1
1
1
1
1
1481
5303461
1
5303461
1
1
5303461
1
1
1
5303461
2193361
1
1
1
3581
1481
1
2193361
1
1
1
1
1
1
1
1
1
1
1
1
1
5303461
5303461
148...

result:

ok 66666 numbers

Test #21:

score: 0
Accepted
time: 89ms
memory: 38196kb

input:

100000 66666
977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 72824662358594073 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 977142648636961 9771426486369...

output:

977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
977142648636961
320578543307887433
977142648636961
982461370523776742
977142648636961
977142648636961
977142...

result:

ok 66666 numbers

Test #22:

score: 0
Accepted
time: 142ms
memory: 38384kb

input:

100000 66666
39302646579895813 92257280832229991 92257280832229991 38805014811590903 38313683824489693 92257280832229991 93440379306034261 93440379306034261 38805014811590903 94638649720590431 93440379306034261 91089162199144621 38313683824489693 38805014811590903 16322063266379399 16115400918867469...

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 66666 numbers

Test #23:

score: 0
Accepted
time: 146ms
memory: 38288kb

input:

100000 66666
18986649113634949 149417824264164721 18986649113634949 2412649537226281 18986649113634949 306577414194589 2412649537226281 2412649537226281 18986649113634949 2412649537226281 149417824264164721 2412649537226281 2412649537226281 18986649113634949 2412649537226281 2412649537226281 3065774...

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 66666 numbers

Test #24:

score: 0
Accepted
time: 139ms
memory: 38264kb

input:

100000 66666
523941011210103901 523941011210103901 927478369620543313 295979067781577977 523941011210103901 295979067781577977 523941011210103901 167201281614739429 295979067781577977 523941011210103901 523941011210103901 927478369620543313 927478369620543313 167201281614739429 927478369620543313 16...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
550909
1
1
1
537255822253
1
1
975217
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
975217
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
752045370831378182
1
1
1
1
1
1
1
1
1
1
1
1
1
537255822253
975217
1
1
1
1
975217
...

result:

ok 66666 numbers

Test #25:

score: 0
Accepted
time: 135ms
memory: 38248kb

input:

100000 66666
119336946756580697 21407447765136011 3840209023880993 142689178022006377 99806495899686217 17903946813319771 99806495899686217 621161893216905093 823684604342419 142689178022006377 21407447765136011 99806495899686217 17903946813319771 21407447765136011 21407447765136011 3840209023880993...

output:

522553
93739
1
853776535995198818
93739
1
478300669305073451
151605490118300919
1
1
522553
1
1
1
522553
809559597344142227
1
1
93739
190997843089
93739
648193084672583815
1
1
1
40967036387
1
522553
1
119336946756580697
1
1
1
335265327363373768
1
1
99806495899686217
93739
1
1
1
1
1
1
228372905249
1
4...

result:

ok 66666 numbers

Test #26:

score: -100
Wrong Answer
time: 452ms
memory: 38344kb

input:

100000 66666
12600 320892 5353920 1290240 5483520 24806400 7920640 9175040 34546176 1146880 38535168 260112384 132710400 3371335680 6955597824 644087808 4128768000 33973862400 2179989504 84557168640 66303557632 52781121536 434865438720 642634481664 1449551462400 7187359334400 1855425871872 460812409...

output:

3186
gcd[2414,2414]=252201579132747776gcd[2414,2424]=36028797018963968gcd[2414,2425]=9007199254740992gcd[2414,2428]=4503599627370496gcd[2414,2434]=562949953421312gcd[2414,2437]=35184372088832gcd[2414,2439]=17592186044416gcd[2414,2442]=4398046511104gcd[2414,2443]=274877906944gcd[2414,2446]=6871947673...

result:

wrong answer 1st numbers differ - expected: '1', found: '3186'