Submission #237733

#TimeUsernameProblemLanguageResultExecution timeMemory
237733Dynamic_CastRack (eJOI19_rack)C++14
40 / 100
5 ms384 KiB
//#include <bits/stdc++.h> C++11 #include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> #include <stdio.h> #include <time.h> #include <iomanip> #include <stdlib.h> #include <list> #include <stack> #include <queue> #include <climits> #include <map> #include <set> #include <sstream> using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef vector<int> vi; #define PB push_back #define MP make_pair vi v; int N; ll sum = 1; /*void result(int n, int s) { int temp; if (n == 1) { temp = (1 + s) % 1000000007; v.PB(1 + s); temp = ll(pow(2, ll(N - 1)) + 1 + s) % 1000000007; v.PB(temp); } else { result(n - 1, s); result(n - 1, s + pow(2, N - n)); } }*/ ll result(int index, int n) { index--; int c = n; for (ll s = 1; c >= 1; s = (2 * s) % 1000000007) { c--; if (c >= 60) { continue; } if ((index % ll(pow(ll(2), c + 1))) >= ll(pow(ll(2), c))) { sum = (sum + s) % 1000000007; } } return sum; } int main() { ios::sync_with_stdio(0); cin.tie(0); ll k; cin >> N >> k; cout << result(k, N) << "\n"; /*result(N, 0); for(int i=0;i<int(v.size());i++){ cout<<v[i]<<" "; } cout << v[k - 1] << "\n";*/ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...