# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
634723 | smartmonky | Rack (eJOI19_rack) | C++14 | 10 ms | 8132 KiB |
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 <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int ll
using namespace std;
const int N=1e6+6,mod=1e9+7;
int pw[N];
main(){
int n,k;
cin >>n >>k;
pw[0]=1;
int ans=0;
for(int i=1;i<N;i++)
pw[i]=(pw[i-1]*2)%mod;
for(int i=0;i<1000;i++){
int s=n;
for(int j=0;j<=n;j++){
if(k<=(1LL <<j)){
if(j==0){
cout<<(ans+1)%mod;
exit(0);
}
ans=(ans+pw[s])%mod;
k-=(1LL << (j-1));
break;
}else
s--;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |