Submission #1265907

#TimeUsernameProblemLanguageResultExecution timeMemory
1265907rutra454Rack (eJOI19_rack)C++20
40 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll pot(ll dl){
    ll wyn = 1;
    for(int i = 1; i < dl; ++i){
        wyn *= 2;
        wyn %= 1000000007;
    }
    return wyn;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k;
    cin >> n >> k;
    ll pocz = 1, dl = n;
    for(int i = 0; i < n; ++i){
        //cout << pocz << ' ' << dl << ';' << k << '\n';
        if(k % 2 == 0){
            pocz += pot(dl);
            dl--;
        }
        else{
            dl--;
        }
        k = k/2 + k%2;
    }
    cout << pocz;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...