Submission #1219697

#TimeUsernameProblemLanguageResultExecution timeMemory
1219697SolikhaRack (eJOI19_rack)C++17
0 / 100
0 ms328 KiB
//#include <bits/stdc++.h> #include <iostream> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <random> #include <chrono> using namespace std; //#define int long long #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ss second #define ff first #define pb push_back using ull = unsigned long long; const int mod = 1e9 + 7; int power(int a, int b){ if(b == 0) return 1; if(b == 1) return a % mod; if(b % 2 == 0){ int y = power(a, b / 2); return y * y % mod; }else return power(a, b - 1) * a % mod; } void solve() { int n; long long k; cin >> n >> k; auto rec = [&](auto&& rec, int i, long long j) -> int{ if(i == 1) return 1; if(j % 2) return rec(rec, i - 1, j / 2 + 1); else return (rec(rec, i - 1, j / 2) + power(2, i - 1)) % mod; }; cout << rec(rec, n, k); } signed main() { cin.tie(nullptr)->sync_with_stdio(false); // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int t = 1; //cin >> t; while(t--){ solve(); cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...