QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#423238#8174. Set ConstructioncqbzlyWA 0ms3588kbC++14909b2024-05-27 21:47:562024-05-27 21:47:57

Judging History

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

  • [2024-05-27 21:47:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-05-27 21:47:56]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long 
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define vi vector<ll>
using namespace std;
int T,n,m;
vector<ll>num;
void sol1(int x){
	assert(x>=0);
	ll y=0;
	for(int i=x;i<n;i++)y+=1ll<<i;
	num.pb(y); 
}
void sol2(int x){
	assert(x>=0);
	int sz=num.size();
	for(int i=0;i<sz;i++){
		num.pb(num[i]+(1ll<<x));
	}
}
int main(){
    //freopen("data.in","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    cin>>T;
    while(T--){
    	cin>>n>>m;
		vector<int>v;
		int tmp=m;
		while(tmp)v.pb(tmp&1),tmp>>=1;
		reverse(v.begin(),v.end());
		num.clear(),num.pb(0),num.pb(1<<n-1);
		int lim=n-2;
		if(v[1])sol1(lim--);
		for(int i=2;i<v.size();i++){
			sol2(lim--);
			if(v[i])sol1(lim--);
		}
		num.back()=(1ll<<n)-1;
		for(auto e:num)cout<<e<<" ";
		cout<<"\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 5
4 8
60 2

output:

0 4 2 6 7 
0 8 4 12 2 10 6 15 
0 1152921504606846975 

result:

wrong answer (2 OR 12) is not in A