#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n, k;
cin >> n >> k;
vector <int> a; a.push_back(0);
int N = 1;
for (int i = 1; i <= n; i ++) N *= 2;
for (int i = 0; i <= N / 2; i ++) {
int x = 1;
for (int j = 20; j >= 0; j --) {
if (i & (1 << j)) {
// cout << j << endl;
x += N / (1 << (j + 2));
}
}
// cout << x << ' ' << x + N / 2 << endl;
a.push_back(x);
a.push_back(x + N / 2);
}
// for (int i = 1; i < a.size(); i ++) cout << a[i] << ' ';
cout << a[k] << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |