This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define mod 1000000007
inline ll int hmm(ll int r,ll int k){
if(r==1)return 1;
ll int m=(1+r)/2;
m=m%mod;
//cout<<r<<" "<<m<<endl;
if(k%2==0&&k!=0){
return m+hmm(m,k/2);
}
else return hmm(m,(k+1)/2);
}
int main(){
lalala;
ll int n,k;cin>>n>>k;
ll int arr[n+1];
arr[0]=1;
for(int i=1;i<=n;i++){
arr[i]=(arr[i-1]*(ll int)2)%mod;
}
cout<<hmm(arr[n],k)<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |