Submission #634724

#TimeUsernameProblemLanguageResultExecution timeMemory
634724smartmonkyRack (eJOI19_rack)C++14
100 / 100
10 ms8124 KiB
#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<60;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)

rack.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...