QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#793121#8965. Jelozhouhuanyi100 ✓35ms3748kbC++171.2kb2024-11-29 16:54:442024-11-29 16:54:44

Judging History

This is the latest submission verdict.

  • [2024-11-29 16:54:44]
  • Judged
  • Verdict: 100
  • Time: 35ms
  • Memory: 3748kb
  • [2024-11-29 16:54:44]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<random>
#include<bitset>
#define N 30
using namespace std;
mt19937 RAND(random_device{}());
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,rt,delta[N+1];
int mul(int x,int y)
{
	int res=0;
	for (int i=0;i<n;++i) delta[i]=0;
	for (int i=0;i<(n>>1);++i)
		for (int j=0;j<(n>>1);++j)
			if (((x>>i)&1)&&((y>>j)&1))
				delta[i+j]^=1;
	for (int i=n-1;i>=(n>>1);--i)
		for (int t=0;t<(n>>1);++t)
			if ((rt>>t)&1)
				delta[i-(n>>1)+t]^=delta[i];
	for (int i=0;i<(n>>1);++i) res|=(delta[i]<<i);
	return res;
}
int main()
{
	bool op,opt;
	n=read();
	while (1)
	{
		opt=1,rt=RAND()%(1<<(n>>1));
		for (int i=1;i<=(n>>2);++i)
			for (int j=0;j<(1<<i);++j)
			{
				delta[n>>1]=op=1;
				for (int k=0;k<(n>>1);++k) delta[k]=(rt>>k)&1;
				for (int k=(n>>1);k>=i;--k)
					for (int t=0;t<=i-1;++t)
						if ((j>>t)&1)
							delta[k-i+t]^=delta[k];
				for (int k=0;k<=i-1;++k) op&=(!delta[k]);
				if (op) opt=0;
			}
		if (opt) break;
	}
	printf("%d\n",1<<(n>>1));
	for (int i=0;i<(1<<(n>>1));++i) printf("%d ",(i<<(n>>1))|mul(mul(i,i),i));
	puts("");
	return 0;
}

详细

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

18

output:

512
0 513 1032 1551 2112 2645 3192 3691 4197 4652 5325 5762 6565 7160 7485 8038 8525 8796 9568 9847 10439 11202 11482 12249 12406 13103 13563 14244 14460 15153 15553 16266 16793 17266 17541 18024 18673 18958 19933 20260 20631 21044 21803 22414 22655 23240 24051 24386 25045 25134 25836 26385 26999 27...

result:

points 1.0 OK, |S| = 512

Subtask #2:

score: 20
Accepted

Test #2:

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

input:

20

output:

1024
0 1025 2056 3087 4160 5205 6264 7275 8704 9801 10920 12007 13248 14237 15192 16131 16420 17717 19052 20347 20845 21608 23317 24086 25151 26470 26839 28040 29430 30651 30766 32101 33056 34056 35258 36244 37700 38776 39918 40916 41850 42778 43840 44838 45214 46314 47252 48358 49628 50404 51974 52...

result:

points 1.0 OK, |S| = 1024

Subtask #3:

score: 20
Accepted

Test #3:

score: 20
Accepted
time: 7ms
memory: 3736kb

input:

26

output:

8192
0 8193 16392 24591 32832 41045 49272 57451 66048 74313 82600 90855 99264 107421 115544 123651 135168 143633 152136 160607 169280 177221 186168 194107 204288 212825 220392 228791 236224 244621 251928 260435 264529 273776 279001 288254 301841 311076 316329 325530 330516 339837 344892 354131 36680...

result:

points 1.0 OK, |S| = 8192

Subtask #4:

score: 20
Accepted

Test #4:

score: 20
Accepted
time: 16ms
memory: 3736kb

input:

28

output:

16384
0 16385 32776 49167 65600 82005 98424 114795 131584 148041 164520 180967 197568 213917 230232 246531 266240 282897 299592 316255 333120 349253 366392 382523 400896 417625 433384 449975 465600 482189 497688 514387 527281 544656 557881 575262 596465 613828 627017 644474 663985 681432 698777 7162...

result:

points 1.0 OK, |S| = 16384

Subtask #5:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 35ms
memory: 3732kb

input:

30

output:

32768
0 32769 65544 98319 131136 163925 196728 229483 262656 295497 328360 361191 394176 426909 459608 492291 528384 561425 594504 627551 660800 693317 726840 759355 794112 827225 859368 892343 924352 957325 989208 1022291 1057571 1091330 1125291 1159052 1192291 1226070 1259995 1293800 1313059 13468...

result:

points 1.0 OK, |S| = 32768