제출 #1179295

#제출 시각아이디문제언어결과실행 시간메모리
1179295vladkonovalRack (eJOI19_rack)C++20
40 / 100
1 ms1936 KiB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
using ll = long long;
ll n,k,a[1000007],res,i;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>k;
    if (k==1){cout<<1;return 0;}
    a[1] = 1;
    res = (1<<(n-1))%1000000007;
    for (i=2;i<=(1<<n);i++) {
        if (i%2==0) a[i] = a[i-1]+res;
        else {
            a[i%1000000007] = (a[(i-1)/2+1]+1)/2;
        }
        a[i%1000000007]%=1000000007;
        if (a[i%1000000007]==k) {cout<<i;return 0;}
    }

    return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…