QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90384#5827. 异或图LWLAymh100 ✓3011ms58700kbC++143.7kb2023-03-22 20:39:212023-03-22 20:39:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 20:39:24]
  • 评测
  • 测评结果:100
  • 用时:3011ms
  • 内存:58700kb
  • [2023-03-22 20:39:21]
  • 提交

answer

#include<algorithm>
#include<cstring>
#include<cstdio>
#define ll long long
#define qwq 23
const int mod=998244353;
inline void Mod(ll &x){
	if(x>=mod)x-=mod;
	if(x<0)x+=mod;
}
inline void Modint(int &x){
	if(x>=mod)x-=mod;
	if(x<0)x+=mod;
}
inline ll mpow(ll x,ll k){
	ll ans=1;
	for(;k;k=k>>1,x=x*x%mod){
		if(k&1)ans=ans*x%mod;
	}
	return ans;
}
int n,m;
ll C;
ll a[qwq];
struct Edge{
	int a,b;
}e[qwq*qwq];
ll f[1<<16|7]; 
ll presum[qwq],sufsum[qwq][2];
const int MaxBit=60;
inline ll get_f(int S){
	ll ans=0;
	for(int bit=MaxBit;bit>=0;--bit){
		ll sum=0;
		for(int i=1;i<=n;++i){
			if(!(S&(1<<(i-1))))continue;
			sum=sum^(a[i]>>bit);
		}
//		printf("%d:%lld\n",bit,sum);
		sufsum[n+1][0]=1;sufsum[n+1][1]=0;
		for(int i=n;i>=1;--i){
			sufsum[i][0]=sufsum[i+1][0];
			sufsum[i][1]=sufsum[i+1][1];
			if(!(S&(1<<(i-1))))continue;
			ll val=(a[i]&((1ll<<bit)-1))+1; 
			val%=mod;
//			printf("val:%d:%lld\n",i,val);
			ll tmp0=sufsum[i+1][0];
			ll tmp1=sufsum[i+1][1];
			if((a[i]>>bit)&1){
				sufsum[i][0]=tmp1*val;
				sufsum[i][1]=tmp0*val;
				val=1ll<<bit;val%=mod;
				sufsum[i][0]=(sufsum[i][0]+tmp0*val)%mod;
				sufsum[i][1]=(sufsum[i][1]+tmp1*val)%mod;
			}
			else {
				sufsum[i][0]=tmp0*val%mod;
				sufsum[i][1]=tmp1*val%mod;
			}
		}
		presum[0]=1;
		int w=(C>>bit)&1;
		for(int i=1;i<=n;++i){
			presum[i]=presum[i-1];
			if(!(S&(1<<(i-1))))continue;
			ll val=((a[i]&((1ll<<bit)-1))+1)%mod;
			presum[i]=presum[i]*val%mod;
//			printf("%d:%lld %lld %lld\n",i,presum[i-1],sufsum[i+1][0],sufsum[i+1][1]);
			if((a[i]>>bit)&1){
				ans+=presum[i-1]*sufsum[i+1][w]%mod;
				Mod(ans);
			}
			w^=(a[i]>>bit)&1;
		}
//		printf("nowans:%lld\n",ans);
		if(sum!=(C>>bit)){
			return ans;
		}
	}
	++ans;Mod(ans);
	return ans;
}
inline int lowbit(int x){
	return x&(-x);
}
int mina[1<<16|7];
int tmp[1<<16|7];
int g[1<<16|7];
int h[1<<16|7];
int To3[1<<16|7];
int dp[20000007];
int ppc[1<<16|7];
int main(){
	scanf("%d%d%lld",&n,&m,&C);
	for(int i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		mina[1<<(i-1)]=i;
	}
	for(int i=1;i<=m;++i){
		scanf("%d%d",&e[i].a,&e[i].b);
		++tmp[(1<<(e[i].a-1))|(1<<(e[i].b-1))];
	}
	for(int S=1;S<(1<<n);++S){
		f[S]=get_f(S);
		ppc[S]=ppc[S^lowbit(S)]+1;
		for(int i=n;i>=1;--i){
			To3[S]=To3[S]*3;
			if(S&(1<<(i-1))){
				++To3[S];
			}
		}
		if(S==lowbit(S))continue;
		mina[S]=mina[lowbit(S)];
		if(a[mina[S^lowbit(S)]]<a[mina[S]]){
			mina[S]=mina[S^lowbit(S)];
		}
	}
	for(int mid=1;mid<(1<<n);mid=mid<<1){
		int len=(mid<<1);
		for(int i=0;i<(1<<n);i+=len){
			for(int k=0;k<mid;++k){
				tmp[i+k+mid]+=tmp[i+k];
			}
		}
	}
	for(int S=0;S<(1<<n);++S){
		if(tmp[S]==0)tmp[S]=1;
		else tmp[S]=0;
		g[S]=tmp[S];
		for(int s1=(S-1)&S;s1;s1=(s1-1)&S){
			if(s1&lowbit(S))continue;
			g[S]=(1ll*g[S]-1ll*g[S^s1]*tmp[s1])%mod;
			Modint(g[S]);
		}
		h[S]=1ll*g[S]*(a[mina[S]]%mod+1)%mod;
//		printf("S:%d g:%lld mina:%d\n",S,g[S],mina[S]);
	}
//	printf("OK\n");
//	return 0;
	int nS=(1<<n)-1;
	dp[0]=1;
	int w=0,Lim=0,TS=0,nows=0,toS=0;
	for(int S=0;S<(1<<n)-1;++S){
		for(int s1=S;;s1=(s1-1)&S){
			w=lowbit(nS^S);
			Lim=nS^S^w;
			TS=To3[S]+To3[s1];
			for(int s2=Lim;;s2=(s2-1)&Lim){
				nows=s2^w;
				toS=To3[S^nows]+To3[s1];
				if(ppc[nows]&1){
					toS+=To3[(1<<(mina[nows]-1))];
					dp[toS]=(1ll*dp[TS]*g[nows]+dp[toS])%mod;
				}
				else {
					dp[toS]=(1ll*dp[TS]*h[nows]+dp[toS])%mod;
				}
				if(s2==0)break;
			}
			if(s1==0)break;
		}
	}
	ll ans=0;
	for(int S=0;S<(1<<n);++S){
//		printf("S:%d %lld %lld\n",S,f[S],dp[(1<<n)-1][S]);
		ans+=f[S]*dp[To3[(1<<n)-1]+To3[S]]%mod;
		Mod(ans);
//		printf("nowans:%lld\n",ans%mod);
	}
	printf("%lld\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 1ms
memory: 1748kb

input:

4 6 2
7 11 14 0
1 2
1 3
2 3
2 4
4 1
4 3

output:

44

result:

ok 1 number(s): "44"

Test #2:

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

input:

4 4 6
12 14 14 5
4 2
1 4
3 2
1 2

output:

798

result:

ok 1 number(s): "798"

Test #3:

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

input:

3 3 2
10 4 11
2 1
3 2
1 3

output:

33

result:

ok 1 number(s): "33"

Test #4:

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

input:

4 0 4
9 8 5 2

output:

148

result:

ok 1 number(s): "148"

Test #5:

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

input:

5 6 14
12 15 13 13 12
3 1
2 4
2 5
2 1
5 3
4 5

output:

21337

result:

ok 1 number(s): "21337"

Test #6:

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

input:

4 5 5
5 2 4 13
2 1
3 4
1 4
4 2
3 2

output:

42

result:

ok 1 number(s): "42"

Test #7:

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

input:

4 4 3
13 7 8 12
4 1
3 1
2 4
4 3

output:

552

result:

ok 1 number(s): "552"

Test #8:

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

input:

4 2 12
1 12 4 11
2 1
3 1

output:

70

result:

ok 1 number(s): "70"

Test #9:

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

input:

5 5 6
10 7 8 2 13
1 5
1 3
2 1
4 3
5 3

output:

1231

result:

ok 1 number(s): "1231"

Test #10:

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

input:

5 7 9
6 7 13 15 12
1 3
5 3
5 2
4 5
4 3
4 1
3 2

output:

6223

result:

ok 1 number(s): "6223"

Test #11:

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

input:

3 0 3
15 7 12

output:

104

result:

ok 1 number(s): "104"

Test #12:

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

input:

3 2 9
10 6 5
1 2
1 3

output:

17

result:

ok 1 number(s): "17"

Test #13:

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

input:

5 5 11
7 9 15 9 9
5 4
5 1
5 2
1 3
3 4

output:

5224

result:

ok 1 number(s): "5224"

Test #14:

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

input:

5 0 12
9 8 14 11 2

output:

3006

result:

ok 1 number(s): "3006"

Test #15:

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

input:

3 1 1
6 10 4
3 1

output:

30

result:

ok 1 number(s): "30"

Subtask #2:

score: 50
Accepted

Dependency #1:

100%
Accepted

Test #16:

score: 50
Accepted
time: 2ms
memory: 1748kb

input:

9 27 705410105529944560
929827299070190972 733413770730537329 473007347105710981 190062421504120247 918561152768663129 196040702922254016 981530663192980241 203295856357272834 337150461958783092
2 8
7 9
8 9
2 3
9 2
2 7
9 5
9 4
4 8
1 7
6 3
6 1
4 1
6 5
2 4
2 1
9 3
9 6
7 3
7 5
5 2
4 5
2 6
3 1
3 8
4 3
8 6

output:

5392583

result:

ok 1 number(s): "5392583"

Test #17:

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

input:

9 7 788762650337246371
605340092851479114 625896945107761227 361131331380167081 572133549445050458 929899192003968010 340514051531987427 690728985364969400 268762741220048006 818120252827139346
5 8
9 6
6 1
1 9
9 8
5 1
4 5

output:

35237078

result:

ok 1 number(s): "35237078"

Test #18:

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

input:

7 8 968166787047166534
945734997493219809 465616677643913237 530128109571749460 717120283671096308 118646732725835921 510958884109370001 797022604947155276
5 2
4 7
1 2
6 5
4 2
4 6
1 6
6 3

output:

133871438

result:

ok 1 number(s): "133871438"

Test #19:

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

input:

12 21 341964498832651322
422448536649714733 488538974423366199 893293448611252565 879334133559023407 13516625885288091 43377983230712374 263189254162337644 474056776923289355 540904774976211471 103364876621830299 515157013276720499 213857038587555252
12 9
8 3
1 9
1 7
3 1
8 11
11 10
6 10
6 1
10 2
7 9...

output:

296076062

result:

ok 1 number(s): "296076062"

Test #20:

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

input:

11 42 215284372701527433
670445786006000260 969876209382224733 248721347029697734 375741447316879814 840434941395805804 187091598433077755 126574401069916039 764298539206353847 750906714570719526 387387869969339518 713140316419888823
1 10
2 5
1 7
4 11
3 11
2 7
4 5
9 5
1 6
3 4
10 9
11 9
3 7
2 1
8 11
...

output:

861118590

result:

ok 1 number(s): "861118590"

Test #21:

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

input:

7 20 619868500075052677
653541655679358091 619279335581334164 74945438024390700 772996180610853550 636253173293891586 125935970032544337 454311587629767538
7 3
4 5
6 7
2 7
4 2
5 3
4 6
2 6
7 4
5 7
2 5
6 3
5 1
2 3
3 4
1 7
2 1
1 3
5 6
4 1

output:

396474896

result:

ok 1 number(s): "396474896"

Test #22:

score: 0
Accepted
time: 138ms
memory: 8004kb

input:

13 1 655058659126783551
220930961455414900 363602338013759573 443737606888655227 137555247528320912 492558319379424931 930253239754276705 727679308735300884 787033056632957722 29595553176095069 586820353385061840 342786039873677428 141912073483259823 800159879032310691
4 9

output:

504321097

result:

ok 1 number(s): "504321097"

Test #23:

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

input:

8 20 301184670062888420
242892377877643484 3476501038317923 44616426924438256 159029640149965614 908446126450853551 608694214104046729 348038770876101788 993564634039215219
5 7
3 8
3 4
8 5
4 6
7 1
6 7
2 4
7 4
3 6
1 2
8 4
8 1
5 4
7 8
1 6
2 5
3 1
8 2
1 4

output:

4724341

result:

ok 1 number(s): "4724341"

Test #24:

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

input:

6 11 392024297517399665
88458611428053942 931089704347713876 2933742226147026 827268679955144802 950336975252592744 47151195847292633
3 5
6 4
5 4
2 3
6 5
5 1
1 4
5 2
2 4
1 3
3 4

output:

708968421

result:

ok 1 number(s): "708968421"

Test #25:

score: 0
Accepted
time: 7ms
memory: 2384kb

input:

11 37 271739451037214460
146061942241336421 138038807419718309 876032468776218591 790840232774594443 931090305572222272 446985261776711380 111295394912463090 788835018487784052 490717555570673932 654796069953431186 30534002965260366
10 6
6 7
4 7
2 5
6 4
2 10
3 4
10 7
2 11
4 9
9 7
6 11
1 11
1 9
9 10
...

output:

405837840

result:

ok 1 number(s): "405837840"

Test #26:

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

input:

7 20 603717808363574959
741883086260303904 498239876637304614 692656406513867207 11452440849146981 847091012107531819 751030904432703677 42306162304440584
7 4
3 5
3 1
7 3
2 1
2 4
7 2
5 6
5 7
4 5
1 6
3 2
1 5
6 3
2 5
3 4
4 6
6 2
7 1
4 1

output:

409098870

result:

ok 1 number(s): "409098870"

Test #27:

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

input:

7 14 276788100956613806
955375196371523555 993133468996644095 851781246244565785 406378187351709927 103400146137304775 3339166120945122 878092054213365193
6 5
3 4
6 3
2 7
1 4
6 1
7 6
3 7
4 2
4 6
1 7
1 5
4 7
3 2

output:

424423580

result:

ok 1 number(s): "424423580"

Test #28:

score: 0
Accepted
time: 10ms
memory: 2360kb

input:

11 42 703121070332973172
453838237041390989 7923458002585165 10157854185578313 428694248761966896 99567674522515040 887169792891871053 685704683091155403 1114809813572478 44938950664511738 433569272578015242 743893677718957742
10 2
5 4
7 3
5 9
10 7
6 1
9 7
5 7
8 6
2 5
2 11
1 10
3 5
4 3
4 1
5 11
11 7...

output:

266801727

result:

ok 1 number(s): "266801727"

Test #29:

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

input:

9 30 557579472218086545
389315525875489778 580024732015329877 122856826128791692 353894892064461662 593243941610294518 367724855679451396 93186374563462910 566339146552758642 503166485328553628
1 2
6 4
7 6
7 2
5 7
6 2
7 3
5 1
9 2
5 6
8 3
1 9
2 3
7 4
6 3
7 8
4 5
8 9
9 7
1 7
6 9
1 4
4 3
2 4
2 5
1 6
8 ...

output:

949276406

result:

ok 1 number(s): "949276406"

Test #30:

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

input:

8 3 145845032992032081
128648457003011001 90366745088645729 628278583922604945 949868219248781702 205548014539121837 573918524435421016 330291118265768760 961310581410805998
4 6
8 3
8 5

output:

522900734

result:

ok 1 number(s): "522900734"

Test #31:

score: 0
Accepted
time: 138ms
memory: 8104kb

input:

13 75 122013601152601020
102573945790661441 119801481456740433 918257918904279930 290942994898157004 263309413587975225 176964463128718582 761601089984502811 634241033261747054 571682868717366221 514639207383578779 104093621484438574 329127701356038973 75081873200425743
12 10
8 5
6 8
9 10
3 11
11 7
...

output:

692554911

result:

ok 1 number(s): "692554911"

Test #32:

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

input:

13 64 329467924442467878
646292845363466402 340430390655540423 886810138845116533 39936097409539153 913432466960561002 602450520208761333 373828261638409015 667657474356136433 785467436052153428 146484939478409777 905868211050101145 17011363096280257 145760138946384094
12 11
5 7
6 2
7 4
7 11
13 2
3 ...

output:

649034073

result:

ok 1 number(s): "649034073"

Test #33:

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

input:

13 66 384520332466220624
456964675653769808 680045069530079454 274948142501386066 134398246845947863 670356535886270750 178282565665823320 512794756447850828 50252545496862865 541422634474563231 961120209571547713 371355651307501836 186254550272900976 966822162226229042
8 13
13 1
2 4
2 1
6 10
8 9
4 ...

output:

658091946

result:

ok 1 number(s): "658091946"

Test #34:

score: 0
Accepted
time: 148ms
memory: 8108kb

input:

13 65 572440567840425592
511814115740732885 663983644274559529 290152050813440086 965100648598673086 30857576447532207 38983595600942050 44868781971516033 852778926994745179 689837263233427103 463859563825515127 374239587300029375 570685282674371777 524325090774617958
13 9
9 1
8 11
7 2
7 8
7 13
5 7
...

output:

143909590

result:

ok 1 number(s): "143909590"

Test #35:

score: 0
Accepted
time: 33ms
memory: 3744kb

input:

12 47 770433712593606285
440182952918236765 194832650378037376 697219961142716540 563570699573734184 269618082361587938 55268899053737043 485296751296674284 998533476123971567 111577714986287643 348822154801743257 627132722657408754 18059004572680409
8 6
12 1
1 8
7 9
11 1
9 10
9 6
2 5
6 5
5 1
10 3
6...

output:

775067582

result:

ok 1 number(s): "775067582"

Test #36:

score: 0
Accepted
time: 34ms
memory: 3748kb

input:

12 55 4026650049374118
857996118172858941 88567476008765118 124350619367959778 367372126789516747 162295446852695236 401458281846570045 560683838805908801 180182810302793022 266620617912155367 15471844114452206 627626552161917860 304587113952804811
10 7
5 4
7 4
5 10
7 2
9 10
9 1
12 3
9 12
4 3
3 7
6 ...

output:

215932540

result:

ok 1 number(s): "215932540"

Test #37:

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

input:

13 72 103008731614274418
363442214120251460 50427867905538777 595260092919904639 373828918204231160 590436074764227318 232099477938107397 236426318819808960 244361286929299921 731166249407001339 112590684380573953 704728975731111649 956279851373121643 397374860922230268
9 3
1 7
5 8
11 9
8 11
5 7
12 ...

output:

187894198

result:

ok 1 number(s): "187894198"

Test #38:

score: 0
Accepted
time: 140ms
memory: 8096kb

input:

13 67 301754072747398126
265229440645252605 147893078440826980 324796610061770660 551587001457543179 760667349634888702 663754795357245527 13662180881282347 505883171963085228 700459283676605999 680916615477968075 346754098755067485 36257491903674274 90955993330063055
11 10
12 3
10 9
1 5
5 3
7 3
11 ...

output:

610716167

result:

ok 1 number(s): "610716167"

Test #39:

score: 0
Accepted
time: 145ms
memory: 8108kb

input:

13 69 75403304803046764
425586910005736592 969627160068708952 8405841780640838 200628822715657197 443919674658362813 814581495306742342 380276028841733301 16989707177466348 680330714625880719 558713286113730870 9955498253036428 725789604884677928 365353215214093400
3 4
3 6
12 5
3 10
4 1
3 5
3 2
11 9...

output:

260792359

result:

ok 1 number(s): "260792359"

Test #40:

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

input:

12 56 869512898929058396
754220212722812283 166889637803908373 104797582558497589 528115017624931431 615539035822791815 118783102898342804 693208985325316886 154703682974820603 72071186025455087 848518128787570353 935988349833056226 57807088687352158
5 2
3 5
4 8
11 1
7 3
2 3
8 2
12 1
8 1
7 6
1 9
12 ...

output:

243805672

result:

ok 1 number(s): "243805672"

Test #41:

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

input:

4 0 266137408554724708
132280826017951321 850283254994779845 125636870147394639 582930455427494327

output:

774985478

result:

ok 1 number(s): "774985478"

Test #42:

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

input:

5 0 227375183671684403
838078019228775407 525418186087747640 57761599398559037 631551466152686290 559180159956140299

output:

767267818

result:

ok 1 number(s): "767267818"

Test #43:

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

input:

10 0 12788671132569757
97604854595547116 837007520784391111 15665557093666358 394749031141258240 72625652061598325 201830158728703466 9652200671985894 541584810371802861 840666350721214277 28209319880081489

output:

611951263

result:

ok 1 number(s): "611951263"

Test #44:

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

input:

6 0 123695341588462971
746972473676804132 975557135115047878 105838726424604358 739722922748391586 815745791731060342 436086535778078347

output:

964600451

result:

ok 1 number(s): "964600451"

Test #45:

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

input:

10 0 514811793088171031
59031476825104549 506730165360872294 201622444164879971 79022523342161951 806946332677854690 982921196100386080 615442285110985500 66715232445866401 85195983895901861 934202056826291570

output:

997996310

result:

ok 1 number(s): "997996310"

Test #46:

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

input:

3 0 217195448970700851
522826994884125301 493574146457808013 878001063403190253

output:

813992307

result:

ok 1 number(s): "813992307"

Subtask #3:

score: 10
Accepted

Test #47:

score: 10
Accepted
time: 643ms
memory: 20804kb

input:

14 0 731833687287532167
157552918690640051 900457311668526045 111217720157614956 84140984111060473 814012186135880499 784848789620248379 958953377683017264 105083874298571687 104921429970878846 44983041675142735 871013110538758030 686733907990421995 98063590462078176 495161493555059993

output:

231790380

result:

ok 1 number(s): "231790380"

Test #48:

score: 0
Accepted
time: 10ms
memory: 2248kb

input:

11 0 101435837408688522
638776638580507479 933944392115323974 19098604312360490 142362319980029593 419910251764515410 275591812677260089 770239593400917018 928344484461634421 67340905784404712 378109786925249078 110881245457449811

output:

242383534

result:

ok 1 number(s): "242383534"

Test #49:

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

input:

9 0 100988561775675251
622570387572403506 684352103903274038 784649864569409753 270298495621205212 56183537059869110 346856482529145989 86639702870530669 607198038565138736 14747634008501988

output:

20893166

result:

ok 1 number(s): "20893166"

Test #50:

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

input:

10 0 839910859917247463
611237879350518457 292219463776059962 548211857317940894 822255554598388425 335628456629874391 774414280870858683 882480367082748768 654587410087321403 74330774886125511 22894883233341926

output:

61697734

result:

ok 1 number(s): "61697734"

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #51:

score: 20
Accepted
time: 645ms
memory: 20796kb

input:

14 40 324474725199921837
233553584803573447 460606447826448090 455167380666511997 30439560268635822 973104332361054238 83352489208158890 72631589045191661 789358939245182190 304440576655964007 572557927877742909 78163879753806683 923913124140376584 930570695489694619 425161733205954576
6 1
14 12
9 4...

output:

869681460

result:

ok 1 number(s): "869681460"

Test #52:

score: 0
Accepted
time: 603ms
memory: 20808kb

input:

14 19 573584890603170663
582544481689739089 286706763917793298 613599474373618002 631134321620331052 792227112606222926 94269641729646267 47284608718149663 937067815800464590 79441545708627322 377050585754808153 716276998341380853 64299637291735927 325117771569940027 781856209806161620
14 1
10 7
8 3...

output:

695927508

result:

ok 1 number(s): "695927508"

Test #53:

score: 0
Accepted
time: 623ms
memory: 20788kb

input:

14 3 403178289139825648
68692331071886994 151121076203828136 155499750042086003 571679242491897981 74256735000740526 975996874529923479 132043538363052971 903036571253418872 194120235590822947 658941657850697753 41243946543664294 98415464475427481 57242817705547858 326169111664808906
1 7
14 2
9 4

output:

254015559

result:

ok 1 number(s): "254015559"

Test #54:

score: 0
Accepted
time: 619ms
memory: 20692kb

input:

14 60 277724581807035887
583448086193186261 592775557754197284 423131437432375893 188914048427512623 114435096027896898 465470760952411270 515592163221996036 390303504698348035 978373796601617588 735135903875020502 348473114945474202 801820683239811986 653381751020618743 219524647104762180
3 6
7 12
...

output:

280016274

result:

ok 1 number(s): "280016274"

Test #55:

score: 0
Accepted
time: 609ms
memory: 20780kb

input:

14 80 109771736449234213
196832638794305669 7646548728925487 1678593412166803 765856802086869068 671849742070997409 109215535751923555 827587182084590642 189932656529082097 508756290511975700 589342835885957066 153080557043832337 450882618540378182 42464956291437022 266767940675524995
2 9
12 10
6 12...

output:

372919531

result:

ok 1 number(s): "372919531"

Test #56:

score: 0
Accepted
time: 642ms
memory: 20804kb

input:

14 57 698787081325636232
896103438070586170 473579536741379315 123459131562443609 139618860722893475 894758996787480952 100182893984393645 195692445838245155 696487271876509116 205721970208408844 20833730330019198 265318932222854777 907200564582085963 774261631024985426 71155439854468978
4 3
11 1
12...

output:

42730827

result:

ok 1 number(s): "42730827"

Test #57:

score: 0
Accepted
time: 634ms
memory: 20796kb

input:

14 28 533121648734926524
646528202743445543 436787544883399769 735722789407616371 879539203572363009 66768107296051960 822829606859033596 136606166247914959 65781097241271187 52486636727149556 673201177597847603 285256401458353573 306622315564193930 494461056726506608 695569726971045446
10 14
9 10
2...

output:

793832319

result:

ok 1 number(s): "793832319"

Test #58:

score: 0
Accepted
time: 2958ms
memory: 58696kb

input:

15 83 71918829046180114
294882032685557560 149805140146643082 573570451218838875 396247109198767939 872105754972643632 74815333622833379 708958093576097855 240249771870960814 422341186304872952 339065285913329055 977245367193860809 647408550175725183 704449658079415330 150531484553106536 27780809815...

output:

262611672

result:

ok 1 number(s): "262611672"

Test #59:

score: 0
Accepted
time: 591ms
memory: 20792kb

input:

14 26 835561245808638159
704055830798550663 565003526272890532 2629587982696553 324870859036526723 505496087664760330 447124628841315539 775449029115564141 697687687525020041 465052251785432772 940698815635237559 539815013872514599 451344076627232279 482466147482837940 776207821340221545
1 14
4 7
5 ...

output:

43916401

result:

ok 1 number(s): "43916401"

Test #60:

score: 0
Accepted
time: 622ms
memory: 20804kb

input:

14 13 376963249364807927
113303704011369375 872500393964760017 332127440422685442 92865813611665285 581268532190428739 435205233033877794 685523334323428212 567801451533388427 473903823471152035 462883229807743410 864931616106119642 501305940233074713 161617695911264838 546535024158526776
14 3
5 9
8...

output:

854004953

result:

ok 1 number(s): "854004953"

Test #61:

score: 0
Accepted
time: 2796ms
memory: 58696kb

input:

15 89 886495380041742403
22785880197521447 653395261829571401 118409620768335885 470845163495000286 797512936959906130 965170635893199293 419658915386585842 633690860592916541 563670340405260950 629472926543341044 134519538157938623 858977572858732895 178431496380295310 329194620711412754 5430184256...

output:

501735162

result:

ok 1 number(s): "501735162"

Test #62:

score: 0
Accepted
time: 2880ms
memory: 58684kb

input:

15 97 345135034383421994
4163859612725475 910930617600590628 586672335297970176 470021168806710012 427252165934674359 389506836593613171 594583339873970509 177472389251312235 653415335849147504 981440272760276042 541598634587667183 135005166559633285 471262643333094 829559895025043879 32034057593780...

output:

358769225

result:

ok 1 number(s): "358769225"

Test #63:

score: 0
Accepted
time: 613ms
memory: 20684kb

input:

14 89 335430370944924527
557496792609922223 625383441692911287 795513045835847703 803196682425603636 227901896066304129 255979381136857838 223681197961859083 822581563929864126 346049583220275081 85959245266357564 91652097219707804 211417922538048641 826520677353866021 208189020069685166
7 14
5 8
2 ...

output:

404051551

result:

ok 1 number(s): "404051551"

Test #64:

score: 0
Accepted
time: 2998ms
memory: 58672kb

input:

15 88 683606729060406584
556151780310650323 147645908988824054 524830785428982553 72405097141396129 461466784366730729 210121551977778346 16763422447528453 770625663219056599 779368056330588019 559192174336763390 612354249362223612 687563679929024141 352307505689301957 329908377599918332 20994299570...

output:

394651676

result:

ok 1 number(s): "394651676"

Test #65:

score: 0
Accepted
time: 2897ms
memory: 58700kb

input:

15 88 517129652116776720
796170533881876960 40052875090734097 135747510896241448 224743837897167130 705280188944964467 919218264459205837 866583171280617760 848730536103245375 78831181029776102 475181534483106758 646121170215532488 619412441433431228 311293882356415484 900809804255849511 68682183696...

output:

794476840

result:

ok 1 number(s): "794476840"

Test #66:

score: 0
Accepted
time: 2836ms
memory: 58568kb

input:

15 88 41674618682150684
193131552099368670 43688682373440590 80987913055877753 533624442337116662 469409604608996366 117882635947265883 236009873325717685 84557881923159807 92152188655117153 427875905357630216 602470613886232094 85309529454530443 369650967036327935 535029245718712994 357700798527113...

output:

230917122

result:

ok 1 number(s): "230917122"

Test #67:

score: 0
Accepted
time: 631ms
memory: 20792kb

input:

14 90 679990302849562227
254298536450867080 732214648733321753 466637038148587585 957564900460345591 971810713059488251 399751177649257960 526684325847536127 191904249715325174 609927174435023732 951076251235045837 122304252871767413 367890524181737600 613518321863509028 351740693523065473
3 7
14 3
...

output:

496765330

result:

ok 1 number(s): "496765330"

Test #68:

score: 0
Accepted
time: 2894ms
memory: 58564kb

input:

15 94 364880083157295094
49566422031557753 742712981424887092 439867860547205902 469904163864477740 590929368674952701 336600739857678939 48806212982870514 152587367280356237 109570428516443581 593218060742924046 869120650063339483 8712360085375460 609616605489275374 169118106033775026 6733233842920...

output:

783474738

result:

ok 1 number(s): "783474738"

Test #69:

score: 0
Accepted
time: 615ms
memory: 20820kb

input:

14 89 801379746991246499
335026397920555041 783535532219393913 748365417548601753 56957506523190711 655599767102238312 19905399949782991 574864688638174938 90183680413958696 265070292671566367 592530855084572476 489917427815519613 7442773870417111 630575642739100067 651455557784007740
3 12
12 10
1 4...

output:

136140190

result:

ok 1 number(s): "136140190"

Test #70:

score: 0
Accepted
time: 3011ms
memory: 58676kb

input:

15 103 580133409266831664
899592344219321434 53015756628818102 519272859869259098 92454590051859919 11081380400553838 50927634148840416 125328239051348450 71627342353150528 456270567142120333 709740255053364428 194984163130288676 817703316944224656 575391858777222480 320711884164753857 8678371229375...

output:

744970556

result:

ok 1 number(s): "744970556"

Test #71:

score: 0
Accepted
time: 2993ms
memory: 58596kb

input:

15 105 955345679538019750
615462645606843028 137237848086638635 315736591871285923 888925877062886563 818699527929622441 476500710289278487 89428204670590615 372294871178155724 849461475557783931 196122783934725273 461355995222745332 118136016376552022 276528013816248995 800448573761661322 998527164...

output:

292347694

result:

ok 1 number(s): "292347694"

Extra Test:

score: 0
Extra Test Passed