QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140160#5412. 甩锅Lynkcat#40 248ms15588kbC++171.2kb2023-08-15 10:44:272024-07-04 02:37:28

Judging History

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

  • [2024-07-04 02:37:28]
  • 评测
  • 测评结果:40
  • 用时:248ms
  • 内存:15588kb
  • [2023-08-15 10:44:27]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
#define int ll
#define N 5005
using namespace std;
int n,a[N],f[N][N];
void BellaKira()
{
	cin>>n;
	n=(1<<n);
	int sm=0;
	for (int i=1;i<n;i++)
		cin>>a[i],sm=(sm+a[i])%mod;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			if (i==j)
			{
				f[i][i]=(sm+1)%mod;
			} else
			{
				f[i][j]=(mod-a[(i-j+n)%n])%mod;
			}
	int ans=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			while (f[i][i])
			{
				int s=f[j][i]/f[i][i];
        		for(int k=i;k<=n;++k)
				{
        		    f[j][k]=(f[j][k]-1ll*s*f[i][k]%mod+mod)%mod;
        		}
        		swap(f[i],f[j]);
        		ans=mod-ans;
    		}
    		swap(f[i],f[j]);
        	ans=mod-ans;
		}
		// cout<<i<<" "<<f[i][i]<<endl;
	}
	for (int i=1;i<=n;i++)
		ans=ans*f[i][i]%mod;
	cout<<ans<<'\n';
	
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

詳細信息

Test #1:

score: 5
Accepted
time: 1ms
memory: 3880kb

input:

3
145945299 772422151 790720776 412632502 193160068 209134170 435597365

output:

641984640

result:

ok single line: '641984640'

Test #2:

score: 5
Accepted
time: 1ms
memory: 3868kb

input:

3
784588695 85511664 582093918 158811338 84572384 40774093 899812324

output:

969243361

result:

ok single line: '969243361'

Test #3:

score: 5
Accepted
time: 1ms
memory: 3936kb

input:

3
372855041 795539653 63895070 294291056 540596778 687439382 423447319

output:

245789031

result:

ok single line: '245789031'

Test #4:

score: 5
Accepted
time: 1ms
memory: 3968kb

input:

3
630504220 179019282 194220559 18788951 153735450 52733880 504873263

output:

626600242

result:

ok single line: '626600242'

Test #5:

score: 5
Accepted
time: 248ms
memory: 15588kb

input:

8
825156030 146354743 712313249 867321154 204493968 996915669 320486339 989082662 931432388 751585313 149649648 865009828 792359405 51217619 81763086 15975149 695762327 992907563 310266205 87119808 531107648 582718579 880199149 12372572 761737861 923424763 878410930 764478366 976158643 234044896 659...

output:

732911747

result:

ok single line: '732911747'

Test #6:

score: 5
Accepted
time: 248ms
memory: 14628kb

input:

8
229623257 564908155 30978890 338535481 561765248 716244482 335821764 594817950 351552393 556700865 981216695 799215728 567553640 21436520 330250795 106015624 696927149 924173798 465348699 375049270 741805577 579243324 569894211 686733621 336503336 69807378 50166896 30436230 992420600 453049467 732...

output:

255015305

result:

ok single line: '255015305'

Test #7:

score: 5
Accepted
time: 248ms
memory: 15556kb

input:

8
439746803 660236486 89547006 916312558 711338884 734403888 736978555 757551418 677399375 264844303 662231538 486685174 702104863 36199784 529527345 124101879 93949298 321791342 177701195 895768124 830378694 823500899 488204420 801321931 853514182 467533517 919670289 192141258 801487167 683954014 5...

output:

674920898

result:

ok single line: '674920898'

Test #8:

score: 5
Accepted
time: 248ms
memory: 13824kb

input:

8
44212817 153968574 233335803 308952639 18135674 212025413 843915148 354446719 656522067 176576864 854367439 565408855 430046176 810592622 524526782 547080627 974655343 496152722 57780005 787923190 76668817 682065469 741481624 619016585 811141984 37190332 304792788 234547623 392120389 891762731 723...

output:

48726919

result:

ok single line: '48726919'

Test #9:

score: 0
Time Limit Exceeded

input:

12
874298968 20903746 658972437 118046836 341907679 654925800 829333114 494156645 30365595 390043919 234200098 147341368 301312694 610625803 135070099 249617468 433912476 237342996 142946470 787053361 239553467 387879647 598599802 451734283 221824871 558904006 534044231 884094611 282678549 749476344...

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

12
705160062 915446750 23550257 825800203 282134750 51907814 630304809 835514273 154228021 11171371 671447525 356409503 626824142 91103613 144538947 531990473 717398025 602253075 204100501 637885298 20196736 64943737 675616533 131646911 808288369 598446458 162643077 199075636 380026740 926869362 362...

output:


result:


Test #11:

score: 0
Time Limit Exceeded

input:

12
625195457 29156019 635443577 580014560 826143058 281617142 55304000 582239365 230657668 256063835 150535001 12547905 149161722 345251484 511540829 883008713 649524417 353438126 819277404 215830876 552291629 557439629 510051084 903300521 269900017 702718488 431997391 18004616 142130856 122510950 4...

output:


result:


Test #12:

score: 0
Time Limit Exceeded

input:

12
919550950 169351223 561060462 496253428 481673823 899550972 39007945 328319155 568798566 45720435 239274574 172173322 343168572 123293992 319625788 571159912 481399126 156633354 462921674 499449351 757728320 641821270 454783986 111193816 665516558 22539977 803640327 364116738 597299127 144390162 ...

output:


result:


Test #13:

score: 0
Runtime Error

input:

20
952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 952573197 9525731...

output:


result:


Test #14:

score: 0
Runtime Error

input:

20
194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 194681918 1946819...

output:


result:


Test #15:

score: 0
Runtime Error

input:

20
646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 646441218 6464412...

output:


result:


Test #16:

score: 0
Runtime Error

input:

20
503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 503996067 5039960...

output:


result:


Test #17:

score: 0
Runtime Error

input:

20
818441877 273504401 727037070 180301226 448317616 59828958 72304160 381246388 607117624 516456907 196622739 465928987 972505952 384935668 787696325 149967357 511578504 955182169 707492117 840779840 804190013 865023357 400188471 475398357 149223252 359600148 278732258 343905170 7797013 782728324 2...

output:


result:


Test #18:

score: 0
Runtime Error

input:

20
397554611 736410065 273461366 341905432 106415888 471126159 687558115 551173041 9521368 268191004 102506648 865073293 755445670 447707387 891766845 453139682 953556863 422100067 215235400 507135383 362946898 172487685 24035007 574583185 109714434 23071354 524660762 765617511 41089692 318699494 22...

output:


result:


Test #19:

score: 0
Runtime Error

input:

20
251667677 46412782 916653691 782933634 120583065 296303275 739419522 620064813 311112078 944060339 435846539 150806724 832299936 143493240 474429332 671559678 91083981 765549737 632871878 328087771 880147538 253354801 680357822 126781301 886401134 784750696 859882726 840925043 725838720 823802938...

output:


result:


Test #20:

score: 0
Runtime Error

input:

20
97378693 122542862 414654097 651390240 298552171 865036074 792919706 800911593 890378971 662526326 164251214 507560399 389589792 181868653 28480348 861524812 262865926 350332923 880492254 634641792 657667110 466844827 288240202 166187684 91531482 546498116 531553217 662868878 121171396 447281051 ...

output:


result: