Submission #993515

#TimeUsernameProblemLanguageResultExecution timeMemory
993515lazar3141Rack (eJOI19_rack)C++14
100 / 100
6 ms8300 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int md = 1e9+7; void solve(){ int n, k;cin>>n>>k; vector<int> v(1e6+10); v[0] = 1; for(int i = 1;i<1e6+10;i++) v[i] = (v[i-1]*2)%md; int ans = 0; while(k>1){ if(k%2==0) ans+=v[n-1]; ans%=md; k = (k+1)/2; n--; } ans++; ans%=md; cout<<ans<<endl; } int32_t main(){ cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int t = 1; //cin>>t; while(t--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...