Submission #467883

#TimeUsernameProblemLanguageResultExecution timeMemory
467883alontanayRack (eJOI19_rack)C++14
40 / 100
5 ms312 KiB
#include <bits/stdc++.h> #define ll long long #define MOD 1000000007 using namespace std; ll square(ll n) { return n*n; } ll pow2(ll n) { if(n == 0) { return 1; } return ((n%2)+1)*square(pow2(n/2)); } int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, k; cin >> n >> k; ll curr_pow = 1, total = 0; for( ; n >= 60; n --) { curr_pow = (curr_pow*2)%MOD; } for(ll i = pow2(n)/2; i > 0; i >>= 1) { if(i < k) { total = (total + curr_pow)%MOD; k -= i; } curr_pow = (curr_pow*2)%MOD; } cout << (total+1) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...