제출 #624590

#제출 시각아이디문제언어결과실행 시간메모리
624590BlagojRack (eJOI19_rack)C++14
40 / 100
1089 ms8512 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...