QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296386#7775. 【模板】矩阵快速幂zhouhuanyi45 2875ms16056kbC++144.7kb2024-01-02 21:07:052024-01-02 21:07:06

Judging History

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

  • [2024-01-02 21:07:06]
  • 评测
  • 测评结果:45
  • 用时:2875ms
  • 内存:16056kb
  • [2024-01-02 21:07:05]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define M 180000
#define N 300
#define mod 998244353
using namespace std;
const __int128 INF=(__int128)(1e37);
long long read()
{
	char c=0;
	long long sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int MD2(int x)
{
	return x<0?x+mod:x;
}
struct reads
{
	int num;
	long long data;
};
int S,T,n,m,tk,inv[N+1],md[N+1],num[M+1][N+1];
__int128 dsp[N+1][N+1],DP[N+1][N+1],DSP[N+1][N+1],sk;
string k;
vector<reads>E[N+1];
struct frac
{
	__int128 x;
	int y;
	bool operator < (const frac &t)const
	{
		return x*t.y<y*t.x;
	}
	bool operator >= (const frac &t)const
	{
		return x*t.y>=y*t.x;
	}
	bool operator == (const frac &t)const
	{
		return x*t.y==y*t.x;
	}
	bool operator != (const frac &t)const
	{
		return x*t.y!=y*t.x;
	}
};
frac operator + (frac a,frac b)
{
	return (frac){a.x*b.y+a.y*b.x,a.y*b.y};
}
frac operator - (frac a,frac b)
{
	return (frac){a.x*b.y-a.y*b.x,a.y*b.y};
}
struct rds
{
	frac a,b;
	bool operator < (const rds &t)const
	{
		return a!=t.a?a<t.a:b<t.b;
	}
	bool operator == (const rds &t)const
	{
		return a==t.a&&b==t.b;
	}
	bool operator != (const rds &t)const
	{
		return a!=t.a||b!=t.b;
	}
};
rds zero=(rds){(frac){0,1},(frac){0,1}},inf=(rds){(frac){1,0},(frac){1,0}},dp[2][N+1],delta[N+1][N+1];
rds operator + (rds x,rds y)
{
	if (x==inf||y==inf) return inf;
	x.a=x.a+y.a,x.b=x.b+y.b;
	if (x.b>=(frac){sk,1}) x.a=x.a+(frac){1,1},x.b=x.b-(frac){sk,1};
	return x;
}
rds operator - (rds x,rds y)
{
	if (x==inf) return inf;
	x.a=x.a-y.a,x.b=x.b-y.b;
	if (x.b<(frac){0,1}) x.a=x.a-(frac){1,1},x.b=x.b+(frac){sk,1};
	return x;
}
rds change(rds x)
{
	__int128 d;
	if (x.b.x>=0) d=x.b.x/x.b.y/sk,x.a=x.a+(frac){d,1},x.b=x.b-(frac){d*sk,1};
	else d=(-x.b.x+x.b.y*sk-1)/x.b.y/sk,x.a=x.a-(frac){d,1},x.b=x.b+(frac){d*sk,1};
	return x;
}
int get(rds x)
{
	if (x==inf) return -1;
	__int128 res=(x.a.x%mod)*inv[x.a.y]*tk+(x.b.x%mod)*inv[x.b.y];
	res=MD2(res%mod);
	return res;
}
int main()
{
	int x,y,d,op;
	long long z;
	inv[1]=1;
	for (int i=2;i<=N;++i) inv[i]=MD2(-1ll*(mod/i)*inv[mod%i]%mod);
	S=read(),T=read();
	for (int qt=1;qt<=T;++qt)
	{
		n=read(),m=read(),sk=tk=0,cin>>k;
		for (int i=2;i<=n;++i) md[i]=0;
		for (int i=1;i<=n;++i) E[i].clear();
		for (int i=0;i<k.length();++i)
		{
			sk=min(sk*10+k[i]-'0',INF),tk=(tk*10ll+k[i]-'0')%mod;
			for (int j=2;j<=n;++j) md[j]=(md[j]*10ll+k[i]-'0')%j;
		}
		for (int i=1;i<=m;++i) x=read(),y=read(),z=read(),E[x].push_back((reads){y,z});
		for (int i=1;i<=n;++i)
		{
			for (int j=0;j<=n;++j)
				for (int k=1;k<=n;++k)
					DSP[j][k]=INF;
			DSP[0][i]=0;
			for (int j=1;j<=n;++j)
				for (int k=1;k<=n;++k)
					for (int t=0;t<E[k].size();++t)
						DSP[j][E[k][t].num]=min(DSP[j][E[k][t].num],DSP[j-1][k]+E[k][t].data);
			for (int j=0;j<=n;++j) DP[j][i]=DSP[j][i];
		}
		for (int i=1;i<=n;++i)
			for (int j=n*n-i+1;j<=n*n;++j)
				num[i][j%i]=j;
		if (sk<=((n*n)<<2))
		{
			for (int i=1;i<=n;++i) dsp[0][i]=INF;
			dsp[0][1]=0,op=0;
			for (int i=1;i<=sk;++i)
			{
				op^=1;
				for (int j=1;j<=n;++j) dsp[op][j]=INF;
				for (int j=1;j<=n;++j)
					for (int k=0;k<E[j].size();++k)
						dsp[op][E[j][k].num]=min(dsp[op][E[j][k].num],dsp[op^1][j]+E[j][k].data);
			}
			for (int i=1;i<=n;++i) printf("%d ",dsp[op][i]==INF?-1:dsp[op][i]%mod);
			puts("");
		}
		else
		{
			for (int i=0;i<n;++i)
				for (int j=1;j<=n;++j)
					delta[i][j]=inf;
			op=0;
			for (int i=1;i<=n;++i) dsp[0][i]=INF;
			dsp[0][1]=0;
			for (int i=1;i<=n*n;++i)
			{
				op^=1;
				for (int j=1;j<=n;++j) dsp[op][j]=INF;
				for (int j=1;j<=n;++j)
					for (int k=0;k<E[j].size();++k)
						dsp[op][E[j][k].num]=min(dsp[op][E[j][k].num],dsp[op^1][j]+E[j][k].data);
				if (i>=n*n-n+1)
				{
					for (int j=1;j<=n;++j)
						if (dsp[op][j]!=INF)
						{
							for (int k=2;k<=n;++k)
								if (DP[k][j]!=INF)
									d=num[k][((md[k]-i)%k+k)%k],delta[n*n-d][j]=min(delta[n*n-d][j],change((rds){(frac){DP[k][j],k},(frac){dsp[op][j],1}+(frac){-DP[k][j]*(d+i),k}}));
						}
				}
			}
			op=0;
			for (int i=1;i<=n;++i) dp[0][i]=delta[0][i];
			for (int i=n*n-1;i>=0;--i)
			{
				op^=1;
				for (int j=1;j<=n;++j) dp[op][j]=inf;
				if (i>=n*n-n+1)
				{
					for (int j=1;j<=n;++j) dp[op][j]=delta[n*n-i][j];
				}
				for (int j=1;j<=n;++j)
					for (int k=0;k<E[j].size();++k)
						dp[op][E[j][k].num]=min(dp[op][E[j][k].num],dp[op^1][j]+change((rds){(frac){0,1},(frac){E[j][k].data,1}}));
			}
			for (int i=1;i<=n;++i) printf("%d ",get(dp[op][i]));
			puts("");
		}
	}
	return 0;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 47ms
memory: 11996kb

input:

1
1
100 101 899539897889989959
74 35 910832669819965536
35 85 910832669819965536
85 88 910832669819965536
88 30 910832669819965536
30 58 910832669819965536
58 60 910832669819965536
60 34 910832669819965536
34 8 910832669819965536
8 67 910832669819965536
67 89 910832669819965536
89 32 910832669819965...

output:

395495792 395495781 395495783 395495839 395495793 395495789 395495754 395495832 395495845 395495755 395495823 395495773 395495753 395495800 395495782 395495763 395495847 395495761 395495794 395495791 395495786 395495821 395495798 395495765 395495772 395495770 395495757 395495819 395495843 395495828 ...

result:

ok 100 numbers

Test #2:

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

input:

1
1
100 200 998858598565699977
89 61 596014036562538539
89 84 921297646113897322
61 84 946923234442637386
61 35 641628261157284465
84 35 979893473772327497
84 78 700172488379560611
35 78 963617193748189613
35 54 951598888254521423
78 54 680825215292116806
78 21 737055858973038555
54 21 7491794406112...

output:

590375247 265938345 203065828 597548045 369717762 226160283 377877020 360218254 956162456 408060901 387231165 759578975 67601808 790211315 608425007 343195480 177353482 436533546 717630459 417099733 542227025 861764246 913806375 587268602 989846681 435016550 66609901 817090566 256847656 844441854 94...

result:

ok 100 numbers

Test #3:

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

input:

1
1
100 181 348568663892999968
25 19 990622898175774733
19 94 871060999389241529
94 24 969317630558501400
24 43 908457844888427461
43 52 816088481082287266
52 62 978618931332609685
62 99 761714433396732044
99 85 741344935503895668
85 64 964684335126604843
64 69 988098065125373655
69 31 7506975506815...

output:

916998469 916998469 916998469 76035207 62461893 916998469 389136594 916998469 916998469 173423529 164423356 822964468 626456020 916998469 744111524 916998469 398953850 916998469 342238577 916998469 255074799 784015663 916998469 740933556 587088671 811719512 916998469 916998469 916998469 916998469 14...

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 102ms
memory: 10792kb

input:

1
1
100 189 295064635124730243
18 50 754672892083203214
50 88 962632394366987404
88 15 906700334097319336
15 26 967741400981618572
26 91 996214498763867892
91 35 882157548994344280
35 68 983621159612138407
68 51 563935036482744182
51 75 991205513962219551
75 72 974025375183814852
72 11 7979447663592...

output:

663199381 739882534 663199381 28600701 663199381 944601671 836329160 894091561 629507606 663199381 246830507 663199381 491987421 663199381 802123884 663199381 663199381 663199381 414785533 989396289 663199381 663199381 663199381 663199381 663199381 663199381 663199381 663199381 663199381 663199381 4...

result:

ok 100 numbers

Test #5:

score: 0
Accepted
time: 50ms
memory: 10088kb

input:

1
254
40 74 997173688939799978
38 6 890721839505665075
6 10 992308491267087930
10 29 960202932780090595
29 20 952827125924298715
20 34 868314670055961466
34 31 756448635709788087
31 14 857625921909632516
14 18 917667459973696862
18 21 985939328882662624
21 1 734882468602343649
1 11 66102593854575036...

output:

177014577 177014577 177014577 885341552 472856470 177014577 363547548 177014577 499847464 653076748 177014577 177014577 177014577 177014577 487939796 177014577 213466543 586729345 244952763 177014577 177014577 177014577 177014577 890105934 177014577 177014577 890105934 177014577 177014577 798890006 ...

result:

ok 3575 numbers

Test #6:

score: 0
Accepted
time: 53ms
memory: 10088kb

input:

1
356
32 47 967844399484634837
4 30 776954643355911997
30 20 811634053140142741
20 22 747630229183579429
22 2 806282875388761050
2 26 719793351534499411
26 17 797537828929335673
17 24 890423236992687627
24 21 970792227007588899
21 8 850078803097295262
8 15 958474507028658347
15 1 972636122087215360
...

output:

890097469 525779071 636798453 776362497 776362497 687961593 158033324 776362497 345910504 380622623 239804834 440670451 137231885 985041116 222869127 137231885 705696901 637534644 347889826 696528073 291555427 146553026 776362497 624486185 137231885 642408114 520519927 137231885 438373632 263924254 ...

result:

ok 4784 numbers

Subtask #2:

score: 15
Accepted

Test #7:

score: 15
Accepted
time: 1917ms
memory: 15376kb

input:

2
1
300 598 8179377797889487867988994778539839593376697796496698959964978969
1 2 977880533270721156
2 1 977880533270721156
2 3 977880533270721156
3 2 977880533270721156
3 4 977880533270721156
4 3 977880533270721156
4 5 977880533270721156
5 4 977880533270721156
5 6 977880533270721156
6 5 977880533270...

output:

-1 313446627 -1 313436465 -1 313426303 -1 313416141 -1 313405979 -1 313395817 -1 313385655 -1 313375493 -1 313365331 -1 313355169 -1 313345007 -1 313334845 -1 313324683 -1 313314521 -1 313304359 -1 313294197 -1 313284035 -1 313273873 -1 313263711 -1 313253549 -1 313243387 -1 313233225 -1 313223063 -...

result:

ok 300 numbers

Test #8:

score: 0
Accepted
time: 1946ms
memory: 15244kb

input:

2
1
300 598 9284745978997975899894787995823975998931999649789777849997467689
1 2 946893593823801228
2 1 946893593823801228
2 3 761384824565158999
3 2 761384824565158999
3 4 642721010434291429
4 3 642721010434291429
4 5 936762490761905983
5 4 936762490761905983
5 6 785485094128355256
6 5 785485094128...

output:

-1 613575042 -1 416269325 -1 387291578 -1 980556870 -1 491367967 -1 221793101 -1 191668085 -1 356035653 -1 428450970 -1 964149805 -1 511723806 -1 423081033 -1 947783979 -1 325795034 -1 115778037 -1 86469999 -1 111666379 -1 386592847 -1 223100328 -1 381885001 -1 23001328 -1 84087613 -1 517941041 -1 9...

result:

ok 300 numbers

Test #9:

score: 0
Accepted
time: 1904ms
memory: 15064kb

input:

2
1
300 598 7877597936928589688789427798322599997378688496694695996269389696
1 2 866412995946330002
2 1 866412995946330002
2 3 866412995946330002
3 2 866412995946330002
3 4 866412995946330002
4 3 866412995946330002
4 5 866412995946330002
5 4 866412995946330002
5 6 866412995946330002
6 5 866412995946...

output:

708443714 -1 708438498 -1 708433282 -1 708428066 -1 708422850 -1 708417634 -1 708412418 -1 708407202 -1 708401986 -1 708396770 -1 708391554 -1 708386338 -1 708381122 -1 708375906 -1 708370690 -1 708365474 -1 708360258 -1 708355042 -1 708349826 -1 708344610 -1 708339394 -1 708334178 -1 708328962 -1 7...

result:

ok 300 numbers

Test #10:

score: 0
Accepted
time: 2008ms
memory: 14536kb

input:

2
1
300 598 74686617152792803
1 2 920869599353968456
2 1 920869599353968456
2 3 920869599353968456
3 2 920869599353968456
3 4 920869599353968456
4 3 920869599353968456
4 5 920869599353968456
5 4 920869599353968456
5 6 920869599353968456
6 5 920869599353968456
6 7 920869599353968456
7 6 9208695993539...

output:

-1 537762223 -1 537752459 -1 537742695 -1 537732931 -1 537723167 -1 537713403 -1 537703639 -1 537693875 -1 537684111 -1 537674347 -1 537664583 -1 537654819 -1 537645055 -1 537635291 -1 537625527 -1 537615763 -1 537605999 -1 537596235 -1 537586471 -1 537576707 -1 537566943 -1 537557179 -1 537547415 -...

result:

ok 300 numbers

Test #11:

score: 0
Accepted
time: 1219ms
memory: 15072kb

input:

2
40
120 238 7647979978895986883485788838258737687493899697379499657768989994
1 2 940784508355800649
2 1 940784508355800649
2 3 940784508355800649
3 2 940784508355800649
3 4 940784508355800649
4 3 940784508355800649
4 5 940784508355800649
5 4 940784508355800649
5 6 940784508355800649
6 5 94078450835...

output:

383704267 -1 383701847 -1 383699427 -1 383697007 -1 383694587 -1 383692167 -1 383689747 -1 383687327 -1 383684907 -1 383682487 -1 383680067 -1 383677647 -1 383675227 -1 383672807 -1 383670387 -1 383667967 -1 383665547 -1 383663127 -1 383660707 -1 383658287 -1 383655867 -1 383653447 -1 383651027 -1 3...

result:

ok 3146 numbers

Test #12:

score: 0
Accepted
time: 1202ms
memory: 12564kb

input:

2
5697
96 190 8939398847797777979859997957885578698889795859699765658877967896
1 2 940438543633266209
2 1 940438543633266209
2 3 940438543633266209
3 2 940438543633266209
3 4 940438543633266209
4 3 940438543633266209
4 5 940438543633266209
5 4 940438543633266209
5 6 940438543633266209
6 5 9404385436...

output:

57861585 -1 57859879 -1 57858173 -1 57856467 -1 57854761 -1 57853055 -1 57851349 -1 57849643 -1 57847937 -1 57846231 -1 57844525 -1 57842819 -1 57841113 -1 57839407 -1 57837701 -1 57835995 -1 57834289 -1 57832583 -1 57830877 -1 57829171 -1 57827465 -1 57825759 -1 57824053 -1 57822347 -1 57820641 -1 ...

result:

ok 77560 numbers

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #13:

score: 20
Accepted
time: 2767ms
memory: 14400kb

input:

3
1
300 600 9479768887366979469968967538414386738799799469768954967897479478
235 118 610005418879451235
118 235 610005418879451235
229 118 610005418879451235
118 229 610005418879451235
36 235 610005418879451235
235 36 610005418879451235
265 229 610005418879451235
229 265 610005418879451235
24 36 610...

output:

494335567 494326423 494248699 494244127 494344711 494326423 494358427 494335567 494362999 494303563 494344711 494294419 494344711 494344711 494239555 494285275 494298991 494335567 494294419 494221267 494344711 494353855 494289847 494404147 494298991 494294419 494230411 494253271 494230411 494367571 ...

result:

ok 300 numbers

Test #14:

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

input:

3
1
300 600 5776769948887747678764766855867697879888989838869789796489887868
283 274 755089058915384251
274 283 755089058915384251
244 283 888168172221533892
283 244 888168172221533892
282 283 888128579062348874
283 282 888128579062348874
40 244 889268402435235212
244 40 889268402435235212
182 282 9...

output:

176036896 694748344 -1 -1 -1 -1 600566244 -1 -1 -1 -1 -1 718827887 436968623 37585847 -1 -1 504374914 -1 633560024 856820739 157217839 -1 306684175 563519989 184280158 797877375 730487505 574440187 141621833 108771729 627363885 6744545 -1 216801629 -1 -1 -1 -1 635875737 -1 -1 -1 172431836 -1 7053201...

result:

ok 300 numbers

Test #15:

score: 0
Accepted
time: 1922ms
memory: 16056kb

input:

3
1
300 600 7799975936983268595994769498698386999688649798971695584484797589
213 87 992365484371550852
87 213 992365484371550852
292 213 992365484371550852
213 292 992365484371550852
125 292 992365484371550852
292 125 992365484371550852
32 213 992365484371550852
213 32 992365484371550852
231 32 9923...

output:

-1 352350370 352353940 352300390 -1 352257550 352357510 -1 -1 -1 -1 -1 352303960 -1 -1 -1 352328950 -1 -1 352353940 -1 -1 352346800 352325380 352368220 -1 352368220 352325380 -1 352339660 352368220 352278970 352343230 -1 -1 -1 -1 -1 -1 -1 -1 -1 352261120 -1 352314670 352311100 -1 -1 352371790 352275...

result:

ok 300 numbers

Test #16:

score: 0
Accepted
time: 2875ms
memory: 14332kb

input:

3
1
300 600 108915867328921644
78 120 915329174369582501
120 78 915329174369582501
166 120 915329174369582501
120 166 915329174369582501
24 120 915329174369582501
120 24 915329174369582501
2 24 915329174369582501
24 2 915329174369582501
146 2 915329174369582501
2 146 915329174369582501
266 2 9153291...

output:

796638071 796675403 796642219 796633923 796625627 796613183 796621479 796625627 796600739 796609035 796617331 796625627 796617331 796621479 796625627 796600739 796629775 796579999 796675403 796613183 796625627 796617331 796604887 796671255 796629775 796675403 796658811 796596591 796600739 796625627 ...

result:

ok 300 numbers

Test #17:

score: 0
Accepted
time: 1394ms
memory: 12528kb

input:

3
48
120 240 7737895866885999885898998578585996398987747885374658446818863997
97 35 804386118934281915
35 97 804386118934281915
59 35 804386118934281915
35 59 804386118934281915
111 35 804386118934281915
35 111 804386118934281915
62 111 804386118934281915
111 62 804386118934281915
54 59 804386118934...

output:

-1 817576206 817570296 -1 -1 -1 -1 817576206 817576206 -1 -1 -1 817577388 -1 817575024 817573842 817576206 -1 -1 -1 -1 817569114 817573842 -1 817578570 817579752 817578570 -1 -1 -1 817575024 -1 817570296 -1 -1 -1 817577388 817576206 -1 -1 817571478 817575024 -1 -1 817571478 817571478 817572660 81757...

result:

ok 3516 numbers

Test #18:

score: 0
Accepted
time: 1471ms
memory: 10824kb

input:

3
6185
96 192 9829599865896867589898965976864696579885564749989527653879744756
27 20 972718145577806019
20 27 972718145577806019
11 27 972718145577806019
27 11 972718145577806019
44 11 972718145577806019
11 44 972718145577806019
70 11 972718145577806019
11 70 972718145577806019
57 44 972718145577806...

output:

432574626 -1 432575632 -1 432569596 432580662 432581668 -1 432577644 432579656 432583680 432571608 432582674 432582674 -1 432570602 -1 432576638 -1 432584686 -1 -1 -1 -1 432582674 432575632 -1 432576638 432573620 -1 432583680 432570602 -1 432580662 432577644 -1 -1 432578650 -1 432575632 -1 432572614...

result:

ok 83979 numbers

Subtask #4:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #19:

score: 0
Wrong Answer
time: 49ms
memory: 12476kb

input:

4
1
100 101 6888995999928874698772868926699656683388498575797893294688976887
25 90 495511874996847106
90 84 495511874996847106
84 82 495511874996847106
82 40 495511874996847106
40 97 495511874996847106
97 5 495511874996847106
5 24 495511874996847106
24 16 495511874996847106
16 19 495511874996847106
...

output:

460126878 460126871 460126928 460126887 460126916 460126961 460126892 460126942 460126870 460126880 460126909 460126939 460126868 460126885 460126932 460126918 460126903 460126890 460126919 460126891 460126879 460126920 460126956 460126917 460126910 460126945 460126950 460126923 460126924 460126865 ...

result:

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

Subtask #5:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #25:

score: 15
Accepted
time: 1312ms
memory: 14756kb

input:

5
1
300 301 969767789936486493
164 284 964646444984408140
284 241 964646444984408140
241 281 964646444984408140
281 138 964646444984408140
138 242 964646444984408140
242 112 964646444984408140
112 217 964646444984408140
217 170 964646444984408140
170 31 964646444984408140
31 300 964646444984408140
3...

output:

562333388 562333371 562333450 562333457 562333181 562333366 562333433 562333276 562333204 562333354 562333361 562333374 562333436 562333405 562333369 562333286 562333360 562333318 562333396 562333251 562333480 562333220 562333333 562333460 562333359 562333295 562333293 562333335 562333402 562333226 ...

result:

ok 300 numbers

Test #26:

score: 0
Accepted
time: 2735ms
memory: 14508kb

input:

5
1
300 600 798876399989994933
7 196 978372754397099680
7 150 850366341978113658
196 150 741178931696536015
196 241 918555502737513857
150 241 755464499814711391
150 249 715712249601810459
241 249 834572033520725671
241 172 840925258261612828
249 172 765221764158211117
249 92 987381804975984305
172 ...

output:

103349950 4999241 142118823 400506111 885559364 196293932 888044807 431387396 656847997 382995767 154772964 775074870 360166602 822043040 871256466 771891985 42704853 943406678 158027440 486796258 972364206 191106105 158852164 825942858 973808447 981369554 98907807 66904970 935447293 466970182 66575...

result:

ok 300 numbers

Test #27:

score: 0
Accepted
time: 1914ms
memory: 14284kb

input:

5
1
300 319 999568963877948597
127 165 930758488326418731
165 155 912956207532166981
155 28 930375923771407137
28 174 952825751389557214
174 170 969510032281804566
170 241 896480622553779223
241 54 857133548480482773
54 22 748966877674282581
22 105 992399083086354199
105 73 833098032662288489
73 199...

output:

615687095 22340881 220606255 926757569 403722771 339583612 218798352 675170360 910785402 527927433 468935392 80089701 112798914 308829476 977528530 484462850 559184887 21739752 111487269 309000604 260902067 244633941 296132705 230226837 668779298 283618195 103042591 779688636 992598043 560518243 807...

result:

ok 300 numbers

Test #28:

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

input:

5
1
300 548 824591615686303801
277 294 884790950503796190
294 241 928062180696957669
241 164 997854303092696029
164 296 922799499949016142
296 248 944988731600431360
248 153 831789824022472151
153 180 666918059700566083
180 87 790575536963511661
87 285 804674576894023412
285 211 822686794867787872
2...

output:

278188366 278188366 278188366 278188366 278188366 50768692 278188366 278188366 278188366 278188366 888601612 278188366 371280094 739457050 790269377 850776214 278188366 278188366 278188366 18157734 278188366 278188366 278188366 811551034 356306457 730311889 608326520 278188366 109322194 278188366 27...

result:

ok 300 numbers

Test #29:

score: 0
Accepted
time: 1431ms
memory: 11200kb

input:

5
40
120 131 679889999068592637
118 98 812545734198160781
98 91 917010970269512244
91 95 698053144863731543
95 14 628901820405095492
14 22 889645699347522207
22 51 871704747332576532
51 19 994723476638446914
19 108 935669854949015658
108 83 944628276409310798
83 6 997623504444369992
6 44 89978656209...

output:

347797689 625661551 663318864 430007740 779572483 678295713 604524795 482364258 563274534 733628768 109065455 813167359 237637495 314851932 792047890 731351621 209595139 105858678 353663190 171125513 429932280 382442950 478291233 424842463 792632068 72912215 20364781 716856724 782743587 623493496 35...

result:

ok 3150 numbers

Test #30:

score: -15
Wrong Answer
time: 1362ms
memory: 10780kb

input:

5
5333
96 163 896598775993796678
48 22 988628974528111232
22 79 974327267551042014
79 89 963371577075408650
89 35 977281141965145271
35 83 933480640131723472
83 71 671664664777649600
71 6 618937617718672760
6 18 899457718948743597
18 34 950491723718783148
34 50 977014890463222654
50 25 6638914519516...

output:

301347522 422213537 486604400 730721865 21694591 422213537 422213537 254465456 422213537 422213537 611991526 115365870 422213537 422213537 422213537 422213537 868835950 422213537 422213537 422213537 422213537 422213537 422213537 212714492 422213537 966025026 459165854 321559202 422213537 422213537 2...

result:

wrong answer 50126th numbers differ - expected: '190357554', found: '190357680'

Subtask #6:

score: 0
Skipped

Dependency #3:

100%
Accepted

Dependency #4:

0%