QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#422395 | #8174. Set Construction | _qwqUwU | WA | 0ms | 3728kb | C++20 | 955b | 2024-05-27 13:42:56 | 2024-05-27 13:42:57 |
Judging History
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