QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#67816#5099. 朝圣道OvO_Zuo52 3125ms21892kbC++142.5kb2022-12-12 13:33:022022-12-12 13:33:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-12 13:33:04]
  • 评测
  • 测评结果:52
  • 用时:3125ms
  • 内存:21892kb
  • [2022-12-12 13:33:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=1000005;
typedef long long ll;
int mo;
ll n,m;
ll p_cnt[25],p_num[25];
int cnt=0;
int phi[25][N],ni[25][N];
void exgcd(int a,int b,ll &x,ll &y)
{
	if(b==0)
	{
		x=1,y=0;
		return;
	}
	exgcd(b,a%b,y,x);
	y-=(a/b)*x;
}
ll mi(ll x,ll y,ll p)
{
	ll res=1;
//	x%=p,y%=p; 
	for(;y;y>>=1,x=1ll*x*x%p)
		if(y&1) res=1ll*res*x%p;
	return res;
}
void div_p(int p)
{
	int i,j;
	ll x,y;
	for(i=2;i<=p;i++)
	{
		if(p%i) continue;
		p_num[++cnt]=i,p_cnt[cnt]=1;
		while(p%i==0) p/=i,p_cnt[cnt]*=i;
		phi[cnt][0]=1;
		ni[cnt][0]=1; 
	//	cout<<"yin "<<i<<endl;
		for(j=1;j<=p_cnt[cnt];j++) 
		{
	//		cout<<j<<" ";
			if(j%p_num[cnt]==0)
			{
				phi[cnt][j]=phi[cnt][j-1];
				ni[cnt][j]=-1;
			}
			else 
			{
	//			cout<<phi[cnt][j-1]*j<<endl;
				phi[cnt][j]=1ll*phi[cnt][j-1]*j%p_cnt[cnt];
				exgcd(j,p_cnt[cnt],x,y);
				if(x<0) x+=p_cnt[cnt];
				ni[cnt][j]=x;
			}
		//	cout<<"yiny "<<j<<" "<<ni[cnt][j]<<endl;
		}
		if(p==1)
		{
			cout<<"";
			return;
		}
	}
	cout<<"";
}
ll f(int lei,ll v)
{
//	cout<<"lei "<<lei<<" "<<v<<" "<<phi[lei][v]<<endl;
	if(v<=p_num[lei]) return phi[lei][v];
//	cout<<lei<<" "<<v<<" "<<cal_ji(lei,v)<<endl; 
	return 1ll*((v/p_cnt[lei])&1?p_cnt[lei]-phi[lei][v%p_cnt[lei]]:phi[lei][v%p_cnt[lei]])*f(lei,v/p_num[lei])%p_cnt[lei];
}
//ll xi[N];
int calc(ll x,ll y)
{
	ll i,j,a,b,t,ans=0;
//	cout<<x<<" "<<y<<endl;
	for(i=1;i<=cnt;i++)
	{
		
		a=f(i,x)*ni[i][f(i,y)]*ni[i][f(i,x-y)]%p_cnt[i];
		if(a==0)  continue;
	//	cout<<p_num[i]<<endl;
		t=0;
		for(j=x;j;j/=p_num[i]) t+=j/p_num[i];
		for(j=y;j;j/=p_num[i]) t-=j/p_num[i];
		for(j=x-y;j;j/=p_num[i]) t-=j/p_num[i];
	//	cout<<t<<" "<<f(i,x)<<" "<<f(i,y)<<" "<<f(i,x-y)<<endl;
	//	t=get_vp(i,x)-get_vp(i,y)-get_vp(i,x-y);
		b=mi(p_num[i],t,p_cnt[i]);	
		if(b==0) continue;
	//	cout<<a<<" "<<b<<endl;
		ans=(ans+1ll*a*b%p_cnt[i]*(mo/p_cnt[i])%mo*ni[i][mo/p_cnt[i]]%mo)%mo;
	}
//	ll xx,yy,ans=0,tm;
//	for(i=1;i<=cnt;i++)
//	{
//		tm=mo/p_cnt[i];
//		exgcd(tm,p_cnt[i],xx,yy);
//		if(xx<0) xx+=p_cnt[i];
//		ans=(ans+xi[i]*tm*xx%mo);
//	} 
	return ans%mo;
}
int er[N],er_ni[N],mod;
void init (int o, int p)
{
	mo=p;
	div_p(p);
	int i,j;
	er[0]=er_ni[0]=1;
	er_ni[1]=(mo+1)/2;
	for(i=1;i<=N-5;i++)
	{
		er[i]=er[i-1]*2%mo;
		er_ni[i]=1ll*er_ni[i-1]*er_ni[1]%mo;
		if(er[i]==1) mod=i;
	}
}
int ask (long long n)
{
	return 1ll*calc(2*n,n)*er_ni[2*n%mod]%mo*(n%mo)%mo;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 4
Accepted
time: 219ms
memory: 19560kb

input:

1 910276 554767
6
10
7
4
10
12
9
3
3
5
7
10
5
6
1
6
3
9
6
8
12
11
8
2
12
5
9
3
8
2
12
11
2
3
4
9
2
5
5
11
6
4
8
11
3
9
2
2
8
9
2
8
9
6
2
9
2
10
10
7
5
6
4
4
11
12
8
8
2
2
4
3
3
5
6
6
8
11
6
9
9
3
4
1
2
2
6
9
9
2
3
2
12
6
1
7
2
4
12
11
4
7
6
3
9
4
6
5
3
3
12
6
2
1
1
7
2
6
5
9
11
6
3
4
11
1
2
4
5
4
10...

output:

5419
364275
514407
329394
364275
229662
53120
520095
520095
509260
514407
364275
509260
5419
277384
5419
520095
53120
5419
115262
229662
243797
115262
416076
229662
509260
53120
520095
115262
416076
229662
243797
416076
520095
329394
53120
416076
509260
509260
243797
5419
329394
115262
243797
520095...

result:

ok 910276 numbers

Test #2:

score: -4
Wrong Answer
time: 692ms
memory: 15140kb

input:

1 972231 293475
7
1
9
6
5
1
11
5
5
12
2
2
7
3
4
10
10
3
2
10
7
1
10
9
1
3
5
6
7
2
7
4
1
10
1
9
3
10
10
2
6
11
4
10
12
8
5
2
12
4
9
12
7
2
12
4
3
1
2
9
12
1
4
5
6
12
6
5
9
2
5
12
3
4
6
12
12
2
1
6
4
12
10
5
12
7
9
8
3
8
10
5
3
6
12
7
7
10
7
10
8
7
7
2
2
4
8
6
10
8
11
6
11
10
3
9
5
2
5
1
10
2
11
4
4
3...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 12
Accepted

Test #5:

score: 12
Accepted
time: 63ms
memory: 13960kb

input:

3 1 334547
8234

output:

179079

result:

ok 1 number(s): "179079"

Subtask #4:

score: 18
Accepted

Dependency #3:

100%
Accepted

Test #6:

score: 18
Accepted
time: 313ms
memory: 19740kb

input:

4 1000000 581873
49881
62491
206405
26106
129239
174098
141494
61402
149825
241992
8109
243567
71918
203927
278575
263516
143582
32237
195508
269119
9111
105700
80919
229859
150334
171917
78447
62500
190063
138903
6395
222902
118653
136505
242467
64984
170330
287622
27089
35823
107672
273459
188857
...

output:

225562
278095
494263
533616
449513
172629
433105
169217
156602
470240
127840
224903
148625
143635
385698
428034
270424
224704
326598
317786
205590
556103
563899
492571
87003
417735
350849
476300
65308
462020
373541
56205
35476
425631
345156
395965
377993
402141
119653
299737
4555
400632
420936
58015...

result:

ok 1000000 numbers

Subtask #5:

score: 14
Accepted

Dependency #4:

100%
Accepted

Test #7:

score: 14
Accepted
time: 710ms
memory: 21892kb

input:

5 1000000 840643
596357868225427095
792903040511847841
549819683428503148
982786835970534376
855138540813992974
101968907510306081
885121351101383723
127972727417081251
728407510651610501
998897446686193527
889398142082696651
17276066104970301
87773104284997915
716559595019194816
538865162230963483
...

output:

0
149057
0
0
0
0
13853
0
0
0
618602
0
0
0
0
0
243219
264897
0
0
0
0
0
0
0
0
0
0
0
0
311655
0
0
0
670015
171419
0
0
0
0
0
0
0
0
763198
247491
0
0
0
0
0
0
0
0
0
0
0
513609
0
0
0
0
0
0
0
0
0
0
0
0
0
0
37092
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
720992
0
0
456272
0
0
0
0
0
210850
0
0
0
0
0
383431
0
0
...

result:

ok 1000000 numbers

Subtask #6:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 3125ms
memory: 15868kb

input:

6 958477 522361
280121915553826833
734266539148641647
72849162479700582
274266741463686096
60278972064195458
828423669427600612
571432949203039978
518511460268700898
486268614705621285
19216283231217074
611458416727512530
175147354285288662
799769622289998997
400123443628688299
145546980862133838
40...

output:

0
0
0
0
0
0
0
0
0
0
0
193620
0
0
0
138180
0
0
0
0
0
264460
0
0
0
0
0
458514
0
0
0
0
0
0
0
0
0
144011
0
516922
0
0
0
471569
0
189623
0
0
0
0
0
0
0
0
0
0
324506
466417
0
0
0
0
0
0
0
0
0
0
485170
0
0
512806
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
189161
0
0
0
191079
0
0
0
0
0
0
0
0
0
0
0
421120
0
0
0
0
0
0
0
0...

result:

wrong answer 31245th numbers differ - expected: '74623', found: '0'

Subtask #7:

score: 8
Accepted

Dependency #3:

100%
Accepted

Test #13:

score: 8
Accepted
time: 21ms
memory: 11212kb

input:

7 1 731039
314313205082038759

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 0
Accepted
time: 16ms
memory: 11380kb

input:

7 1 587945
675184352277027016

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 28ms
memory: 11924kb

input:

7 1 732151
522404464427087971

output:

0

result:

ok 1 number(s): "0"

Test #16:

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

input:

7 1 952025
865782493150981281

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 20ms
memory: 11448kb

input:

7 1 151005
80048698775676684

output:

0

result:

ok 1 number(s): "0"

Test #18:

score: 0
Accepted
time: 16ms
memory: 11148kb

input:

7 1 819153
214538328031265195

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 18ms
memory: 11376kb

input:

7 1 84501
605460166753167761

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 0
Accepted
time: 18ms
memory: 11344kb

input:

7 1 579977
434091105518396762

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

7 1 161075
649828935660369724

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 0
Accepted
time: 14ms
memory: 11128kb

input:

7 1 629595
216539117331686464

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

7 1 317005
831315176686118434

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

7 1 204399
934354294367869212

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

7 1 98233
515248809013032256

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 8ms
memory: 11220kb

input:

7 1 738315
930635383520033839

output:

51840

result:

ok 1 number(s): "51840"

Test #27:

score: 0
Accepted
time: 20ms
memory: 11380kb

input:

7 1 404535
557582195171952455

output:

0

result:

ok 1 number(s): "0"

Test #28:

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

input:

7 1 277475
413241759909529359

output:

0

result:

ok 1 number(s): "0"

Test #29:

score: 0
Accepted
time: 14ms
memory: 11280kb

input:

7 1 206409
381910309127041513

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 105ms
memory: 16480kb

input:

7 1 694649
641706538274033333

output:

0

result:

ok 1 number(s): "0"

Test #31:

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

input:

7 1 974065
700551256691343002

output:

0

result:

ok 1 number(s): "0"

Test #32:

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

input:

7 1 966571
5339566589982367

output:

0

result:

ok 1 number(s): "0"

Subtask #8:

score: 0
Wrong Answer

Test #33:

score: 16
Accepted
time: 25ms
memory: 11372kb

input:

8 9963 251
831797004675585320
494759973681332858
701341496127272302
252910460485222469
250965009655458584
366193481309061299
633134388675839346
791999098066205672
196620805863610860
363773642045280947
466508590762410710
407790578717064135
181590911404670570
570642047249889864
70138464625729452
23634...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
204
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
63
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9963 numbers

Test #34:

score: 0
Accepted
time: 28ms
memory: 11512kb

input:

8 9967 6043
820328543276206812
181987384710842549
607221769552657162
341958396909446562
323372299362111304
912735937493462137
261510727281638358
792961465908198578
724729139273707925
61144688983588693
803871679975888144
565482268842659147
653581946336745517
701605486107526593
237425098688490866
3911...

output:

0
0
0
4601
3550
0
0
0
0
0
0
0
4890
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1943
0
0
0
3598
0
5239
0
2888
0
0
0
3581
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4367
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1295
0
4008
0
0
0
5375
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9967 numbers

Test #35:

score: 0
Accepted
time: 69ms
memory: 11488kb

input:

8 9958 7341
246592510376086877
843442167129623384
163968090028533751
786994286411665724
810314145468625407
382997160361312553
621227536566512389
782654969130405492
662775335088395473
723417297592011109
102999527027241303
490566704238479035
460383429537079806
770514075045815286
862086443272202320
491...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1875
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4701
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3846
0
0
0
3225
0
2001
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9958 numbers

Test #36:

score: 0
Accepted
time: 54ms
memory: 11404kb

input:

8 9995 6385
923142108771350737
257950038453679451
536185509148236859
123994810398239828
655641306130430676
720060704445331255
100185112829379915
969736120911358569
88295557636108209
985229226008732676
121012502328734425
208637791506917285
465480660767217532
270404172746200856
188217877755686220
8611...

output:

0
0
0
0
0
0
0
0
0
0
0
0
3365
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6290
4175
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
5460
0
0
0
0
0
0
0
3270
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9995 numbers

Test #37:

score: 0
Accepted
time: 26ms
memory: 11384kb

input:

8 9986 173
616350028627206083
373618134733377525
511700823897700555
242227241128829686
514868167357355607
397500099089111965
358047306663207071
864963899222887428
441742103082050692
79747708146834517
193279633511836619
455494397124008884
290304986099763677
192943969860115773
999569762267228801
51519...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
121
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
139
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 9986 numbers

Test #38:

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

input:

8 9922 3815
980134735794669132
340451576512629641
916261323337020513
961588450139733298
606890924942839243
604420709399644601
559517946721716851
536700142889319911
331110861404036875
371230996480430738
574124765433697807
506302435162527428
52794550999031066
927328113430744153
891630507895187405
2415...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2730
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9922 numbers

Test #39:

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

input:

8 9921 7545
84307725194286651
875239149408876992
764783773180591937
695879634385962619
812182005507271555
608328282234108083
301758663052025733
511628080822487181
276931834242496785
509220340102936075
961667521409256800
874525335129851843
368294539474902706
73765674400326403
37830957992997285
315147...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
75
0
0
0
0
0
0
4305
0
0
2535
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
195
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 9921 numbers

Test #40:

score: 0
Accepted
time: 46ms
memory: 11464kb

input:

8 9952 7357
224766152006290767
472480143124120628
191863347926658903
749444983273484702
7260615477914965
260862181156223569
288726169100135869
940760523335181321
604250633147606021
933133954718742400
695601019212574678
673050554223660673
607021343602215395
669832485551539178
853955876448054742
64822...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1337
0
0
0
0
0
0
0
0
2590
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1463
0
0
0
0
0
0
0
0
0
0...

result:

ok 9952 numbers

Test #41:

score: 0
Accepted
time: 51ms
memory: 11396kb

input:

8 9964 7135
828538342263222786
373021611609716674
79938886687698695
36132372667558654
514677924786213726
481129347348919061
140527838258218819
58146584406210174
735896530635868722
419610580516772759
962841512556863078
565618117240702777
786445523170830699
246235334522727834
35415921722589846
5394601...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3610
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4930
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1935...

result:

ok 9964 numbers

Test #42:

score: -16
Wrong Answer
time: 126ms
memory: 11576kb

input:

8 9979 8745
725034740662684938
405429699248793690
485494472420218098
935359060622766351
54775653102112806
329352051104979909
602583900805321870
56411817802250529
972873270657787432
398644445686915691
941779835546089793
193150681056822101
478020269547157778
953450049487365905
443834652742237895
15378...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 620th numbers differ - expected: '495', found: '0'

Subtask #9:

score: 0
Skipped

Dependency #2:

0%