Submission #634721

#TimeUsernameProblemLanguageResultExecution timeMemory
634721smartmonkyRack (eJOI19_rack)C++14
40 / 100
8 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+3,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<=min(n,59LL);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...