This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <vector>
#include <fstream>
#include <bitset>
#include <tuple>
#include <cmath>
#include <cstdint>
#include <stack>
#include <cassert>
#include <cstdio>
#include <queue>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include <sstream>
#define long long int;
using namespace std;
int n, k;
int div(int l, int r, int indx, int mult) {
if (r == l + 1) return l;
int mid= ceil((l + r) / 2.0);
if (indx % mult == 0) {
return div(mid, r, indx, mult * 2);
}
else {
return div(l, mid, indx+(mult/2), mult * 2);
}
}
signed main() {
cin >> n >> k;
int tot = pow(2, n);
int extra = 0;
if (k > tot / 2) {
k -= (tot / 2);
extra = 1;
}
int ans = div(1, tot, k, 2);
cout << (ans + extra)%100000007 << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |