Submission #751405

#TimeUsernameProblemLanguageResultExecution timeMemory
751405ereringRack (eJOI19_rack)C++17
40 / 100
1 ms276 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define mod 1000000007 #define ll long long #define inf INT_MAX #define pb push_back const int N=(1<<18); int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); ll n,k; cin>>n>>k; ll l=1,r=1; for(int i=0;i<n;i++){ r*=2; r%=mod; } k--; while(l<r){ if(k%2==0){ r=(l+r)/2; } else{ l=(l+r)/2+1; } k/=2; } cout<<l%mod; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...