QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422395#8174. Set Construction_qwqUwUWA 0ms3728kbC++20955b2024-05-27 13:42:562024-05-27 13:42:57

Judging History

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

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

answer

#include<bits/stdc++.h>
#define pb push_back
#define P make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline ll read(){
	ll x=0,c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0' && c<='9')x=x*10 + c-'0',c=getchar();
	return x;
}
int n,m;
inline void solve(){
	n=read(),m=read();
	vector<ll>vec(1,0);
	ll cnt=1;
	per(i,__lg(m)-1,0){
		cnt=cnt<<1|1;
		vector<ll>tmp;
		for(auto x:vec)tmp.pb(x<<1),tmp.pb(x<<1|1);
		if((m>>i)&1){
			for(auto &x:tmp)x<<=1;
			tmp.pb(cnt=cnt<<1|1);
		}
		vec.swap(tmp);
	}
	vec.back() =  ((1ll<<n)-1);
	assert(vec.size() == m);
	for(auto x:vec)printf("%lld ",x);
	puts("");
}
int main(){
	//freopen("data.in","r",stdin);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int T=read();while(T--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 5
4 8
60 2

output:

0 2 4 6 7 
0 1 2 3 4 5 6 15 
0 1152921504606846975 

result:

wrong answer (1 OR 6) is not in A