QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#326745#554. 预言Larunatrecy100 ✓17ms3832kbC++14747b2024-02-13 21:59:122024-02-13 21:59:12

Judging History

This is the latest submission verdict.

  • [2024-02-13 21:59:12]
  • Judged
  • Verdict: 100
  • Time: 17ms
  • Memory: 3832kb
  • [2024-02-13 21:59:12]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 2010;
typedef unsigned int UI;
const UI inf = -1;
int n;
UI a[N],b[N],res[N],p[N],C[N];
void mul(UI *A,UI *B)
{
	for(int i=0;i<2*n;i++)C[i]=0;
	for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	C[i+j]^=(A[i]&B[j]);
	for(int i=2*n-2;i>=n;i--)
	if(C[i])
	{
		UI f=C[i];
		for(int j=0;j<=n;j++)
		C[j+i-n]^=(b[j]&f);
	}
	for(int i=0;i<n;i++)A[i]=C[i]; 
}
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)scanf("%u",&a[i]);
	for(int i=1;i<=n;i++)scanf("%u",&b[n-i]);
	b[n]=inf;
	res[0]=p[1]=inf;
	long long m;
	cin>>m;m--;
	while(m)
	{
		if(m&1ll)mul(res,p);
		mul(p,p);
		m>>=1;
	}
	UI ans=0;
	for(int i=0;i<n;i++)
	ans^=(res[i]&a[i]);
	cout<<ans;
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 10
Accepted
time: 2ms
memory: 3700kb

input:

1000
3220920311 4292586732 2013265911 4210785274 4271623391 2880417788 1069014421 4254932088 1793848759 1808792466 4294958007 2103304126 2800745466 4119330231 3755932087 3974099315 4194272511 4276221428 3656379287 1610611199 4286283679 4294373371 4290514558 4292802023 4294481342 1534984158 211392711...

output:

2144804347

result:

ok single line: '2144804347'

Test #2:

score: 10
Accepted
time: 1ms
memory: 3832kb

input:

100
4008962975 3145719783 3753573855 1593828991 2898851711 4226637295 4278169035 3204413183 3720853503 3757557451 4154441471 4008968063 2080351567 4174345210 3984579293 4243586542 2952402352 3700907893 4292499643 3178036221 3958873596 3684921839 3065969661 4018076914 2128523059 3221221279 838858223 ...

output:

1272285767

result:

ok single line: '1272285767'

Test #3:

score: 10
Accepted
time: 1ms
memory: 3760kb

input:

100
4025736087 4227717111 4221173228 2147483639 2822566783 4227603951 3145674218 3035608567 3706169343 4294963170 1996340991 4269273853 2147355085 4176974847 3099045583 4126141820 2684202678 4130831780 2113821609 3345939453 3956793341 3754390766 3204178814 1868496507 4154175487 3153059503 2113862887...

output:

4075083590

result:

ok single line: '4075083590'

Test #4:

score: 10
Accepted
time: 16ms
memory: 3832kb

input:

1000
2109208351 1778375541 1065090419 2139716591 754833271 2505959277 3489328495 4269801406 1240921087 4293914607 4294360797 3154092031 1037414359 4021877695 4294901427 1006499286 3069181943 4290199541 4219385759 2070856317 3887320621 267296175 2927098335 3355361277 3747063807 1068990391 2127555053 ...

output:

2222984435

result:

ok single line: '2222984435'

Test #5:

score: 10
Accepted
time: 16ms
memory: 3832kb

input:

1000
4227178396 4227456983 3975904750 2013200383 2835342139 4294836207 872377828 3968843767 3572758391 1761586550 1291659007 4294963611 1602162587 2139085039 3066015615 3758095740 2608328311 2872442853 1475346365 3613391757 4259307509 3622698207 517964671 3973705599 4288674815 2952525743 2146622927 ...

output:

1071602059

result:

ok single line: '1071602059'

Test #6:

score: 10
Accepted
time: 17ms
memory: 3700kb

input:

1000
4275564451 3619100327 3217599927 2030028659 3166699131 4025597891 4257997199 3606837999 3713132495 4292175615 4219182781 4286574581 1809753982 3220077403 4294571007 4267294174 794623479 1404499733 2877291967 4026530775 4286537725 3656383806 2259679911 3959406559 2144362336 2046670171 1677688234...

output:

2329770293

result:

ok single line: '2329770293'

Test #7:

score: 10
Accepted
time: 17ms
memory: 3636kb

input:

1000
2145898303 4018003829 2147220495 1053687359 1036771199 3746162671 3674139759 4276977590 1560212158 4293885879 4271742683 3217025023 2145716222 3885890455 2931470257 3221225340 3186347767 4246199293 1876932253 3556764287 4145826860 3484327551 4269208541 3487038822 2144329663 4160192502 206020497...

output:

163313124

result:

ok single line: '163313124'

Test #8:

score: 10
Accepted
time: 17ms
memory: 3756kb

input:

1000
4294410171 3183419379 3681646297 1002420907 2645819007 4121819883 4269788351 4275961727 3590190238 2076172255 4258248699 1207959295 1291828221 2012463094 4217364463 4227563502 888395729 4289849790 4240179119 3221085167 4294746077 2668358655 4294483438 1709566903 2538435551 3985624830 4294293454...

output:

304868701

result:

ok single line: '304868701'

Test #9:

score: 10
Accepted
time: 17ms
memory: 3704kb

input:

1000
4189394862 2684083095 3220679679 1476018174 4261408575 3216899677 1676657141 3929014249 3372217701 3439173623 4008193855 1811617046 1065336755 4286577903 3200098303 3755980653 3221186291 2947809023 4219469631 903705527 4261141501 1433004693 2145253375 4210016031 3202351069 4292525951 2684276713...

output:

637535013

result:

ok single line: '637535013'

Test #10:

score: 10
Accepted
time: 17ms
memory: 3696kb

input:

1000
2146959167 4023377767 4038521725 1607333854 1568660859 4217161727 3758026011 4210539580 1608233983 3744462458 4294950783 3202579066 2062925101 3904722623 3587637043 3082252283 1073659255 3690458863 4243569439 4210780927 4088386357 3679358975 3724279775 3757834239 3873374047 4294967255 252995045...

output:

1706419192

result:

ok single line: '1706419192'