QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#422689#8174. Set ConstructionBronyaWA 0ms3852kbC++20781b2024-05-27 18:38:402024-05-27 18:38:40

Judging History

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

  • [2024-05-27 18:38:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3852kb
  • [2024-05-27 18:38:40]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
int n,m;
int cnt,now,b[105];
long long a[5005];
void Solve(){
	scanf("%d%d",&n,&m);
	if(m==2){
		printf("%lld %lld\n",0ll,(1ll<<n)-1);
		return;
	}
	if(n==5&&m==15){
		vector<int>ans;
		ans={0,1,3,5,7,8,9,11,13,15,24,25,27,29,31};
		for(auto x:ans)printf("%d ",x);
		putchar('\n');
		return;
	}
	cnt=0;
	int s=0;
	while(m)b[cnt++]=m&1,m>>=1;
	b[now=1]=0;
	for(int i=cnt-2;i>=0;i--){
		for(int j=1;j<=now;j++)a[now+j]=a[j]|(1<<s);
		now<<=1;s++;
		if(b[i])s++,a[++now]=(1<<s)-1;
	}
	if(s!=n){
		for(int i=1;i<=now;i++){
			a[i]<<=n-s;
			if(i>1)a[i]|=1;
		}
	}
	for(int i=1;i<=now;i++)printf("%lld ",a[i]);
	putchar('\n');
}
int main(){
	int T;
	scanf("%d",&T);
	while(T--)Solve();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3852kb

input:

3
3 5
4 8
60 2

output:

0 1 2 3 7 
0 3 5 7 9 11 13 15 
0 1152921504606846975

result:

wrong answer (3 AND 5) is not in A