이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |