题解:P8942 Digital Fortress
lailai0916 · · 题解
题意简述
多组询问。每次给定
解题思路
构造
要把
反过来,前缀异或和递增要求每个 No。
时间复杂度为
参考代码
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--)
{
int n;
ll m;
cin>>n>>m;
if(n<=63&&(1ll<<(n-1))<=m)
{
cout<<"Yes\n";
for(int i=0;i<n;i++)cout<<(1ll<<i)<<' ';
cout<<'\n';
}
else cout<<"No\n";
}
return 0;
}