제출 #548694

#제출 시각아이디문제언어결과실행 시간메모리
548694StavabRack (eJOI19_rack)C++14
40 / 100
0 ms212 KiB
#include <bits/stdc++.h>

using namespace std;

const int mod = 1000000007;
int i, j, k;

void narrow (int lower, int upper)
{
    if (k % 2 == 0)
    {
        lower = (upper + lower) / 2 + 1;
        k /= 2;
    }
    else
    {
        upper = (upper + lower) / 2;
        k /= 2;
        k++;
    }
    
    i = lower;
    j = upper;
}

int main()
{
    int n;
    cin >> n >> k;

    i = 1 % mod;
    j = 1;
    for (int a = 1; a <= n; a++)
    {
        j = (j % mod) * 2;
    }

    while (j != i)
    {
        narrow(i, j);
    }

    cout << i;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...