Submission #464954

#TimeUsernameProblemLanguageResultExecution timeMemory
464954oscar1fRack (eJOI19_rack)C++17
100 / 100
26 ms16192 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int MODULO=1000*1000*1000+7,MAX_N=1000*1000+1; int n,k,rep; int multi[MAX_N]; vector<int> kBin; signed main() { ios_base::sync_with_stdio(false); cin>>n>>k; k--; multi[0]=1; for (int i=1;i<n;i++) { multi[i]=multi[i-1]*2; multi[i]%=MODULO; } for (int i=0;i<n;i++) { kBin.push_back(k%2); k/=2; } for (int i=n-1;i>=0;i--) { rep+=multi[i]*kBin[n-i-1]; rep%=MODULO; } cout<<rep+1<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...