Submission #899359

#TimeUsernameProblemLanguageResultExecution timeMemory
899359Sputnik123Rack (eJOI19_rack)C++14
100 / 100
1 ms464 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <string.h> #include <stdio.h> #include <algorithm> #include <vector> #include <functional> #include <cstdio> #define pb push_back #define in insert #define pll pair<ll,ll> #define vpl vector<pll> #define vll vector <ll> #define vl vector<ll> ///#define mp make_pair #define F first #define S second #define all(v) v.begin(),v.end() #define endl "\n" #define ll long long #define ull unsigned long long using namespace std; using namespace __gnu_pbds; //#pragma GCC optimize("Ofast,unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt,fma") const ll sz=2e6+5; const ll inf=1e12+7; const ll mod=1e9+7; ll n,k,x,y,l,r; ll modm(ll a,ll n,ll P) { if(n==0) return 1; if(!(n&1)) return modm((a*a)%P,n>>1,P); return (a*modm(a,n-1,P))%P; } ll lcm(ll a,ll b) { return (a/__gcd(a,b))*b; } void solve() { cin>>n>>k; ll ans=0; k--; while(k) { n--; if(k&1) { ans+=modm(2,n,mod); ans%=mod; } k/=2; } cout<<ans+1<<endl; } ///f[i]=f[i-1]+f[i+1] ///f[i+1]=f[i]-f[i-1] ///f[i]=f[i-1]-f[i-2] int main () { //pre(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t=1; ///cin>>t; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...