Submission #638739

#TimeUsernameProblemLanguageResultExecution timeMemory
638739Koful123Rack (eJOI19_rack)C++17
100 / 100
9 ms8148 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define endl "\n" #define mod 1000000007 #define int long long #define double long double #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int N = 1e6+6; int pw[N]; int f(int n,int k){ if(n == 0) return 1; if(k % 2) return f(n-1,k/2+1); return (pw[n-1] + f(n-1,k/2)) % mod; } void solve(){ int n,k; cin >> n >> k; pw[0] = 1; for(int i=1;i<N;i++){ pw[i] = (pw[i-1] * 2) % mod; } cout << f(n,k) << endl; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...