Submission #964824

#TimeUsernameProblemLanguageResultExecution timeMemory
964824pccRack (eJOI19_rack)C++17
100 / 100
5 ms8284 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const ll mxn = 1e6+10; const ll mod = 1e9+7; ll N,K; ll pw[mxn]; ll mad(ll a,ll b){ if(a>mod)a %= mod; if(b>mod)b %= mod; a += b; return a>=mod?a-mod:a; } ll mub(ll a,ll b){ return mad(a,mod-b); } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); pw[0] = 1; for(int i = 1;i<mxn;i++)pw[i] = mad(pw[i-1],pw[i-1]); cin>>N>>K; ll ans = 0; N--; K--; ll now = 0; while(N>60){ now++;N--; } while(N>=0){ if((1ll<<N)<=K){ K -= 1ll<<N; ans = mad(ans,pw[now]); } now++;N--; } cout<<mad(ans,1)<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...