Submission #1104029

#TimeUsernameProblemLanguageResultExecution timeMemory
1104029MeGustaElArroz23Rack (eJOI19_rack)C++14
40 / 100
1 ms336 KiB
#include <algorithm> #include <iostream> #include <bits/stdc++.h> #include <cmath> #include <vector> #define int long long using namespace std; const long long mod = 1e9+7; int binary_exponentiation(int number, int exponent) { int result = 1; while (exponent > 0) { if(exponent & 1) result = result * number; number = number * number; exponent >>= 1; number%=mod; exponent%=mod; } return result; } int make_path(long long seed, int length) { long long path = 0; for (int i = 0; i < min(length, 62LL); i++) { if (((seed >> i) & 1) == 1) path = (path + binary_exponentiation(2, length - i - 1))%mod; } return path; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long height, node; cin >> height >> node; cout << (make_path(node - 1, height) + 1)%mod << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...