标签:mat net codeforce scan main mem exp str print
#include <cstdio>
#include <cstring>
int main() {
int n, x;
while(~scanf("%d %d", &n, &x)) {
n = 1 << n;
int ans[300000], cnt = 0;
bool vis[300000];
memset(vis, false, sizeof(vis));
vis[x] = true;
for(int i = 1; i < n; i++) {
if(vis[i] == false){
ans[cnt++] = i;
vis[i] = vis[i^x] = true;
}
}
printf("%d\n", cnt);
if(cnt) printf("%d ", ans[0]);
for(int i = 1; i < cnt; i++) {
printf("%d ", ans[i] ^ ans[i-1]);
}
if(cnt) printf("\n");
}
return 0;
}
cf 1174 D Ehab and the Expected XOR Problem
标签:mat net codeforce scan main mem exp str print
原文地址:https://www.cnblogs.com/fanshhh/p/11406456.html