This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
int tree[3000000], p = 0;
void search(int l, int r, int k)
{
if (l == r)
{
p = l + 1;
tree[k] = 1;
}
else
{
int mid = (l + r) / 2;
if (tree[k * 2] == tree[k * 2 + 1])
{
search(l, mid, k * 2);
}
else
{
search(mid + 1, r, k * 2 + 1);
}
tree[k] = tree[k * 2] + tree[k * 2 + 1];
}
}
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n, m;
cin >> n >> m;
int d = (1 << n);
for (int i = 0; i < m; i++)
{
search(0, d - 1, 1);
}
cout << p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |