이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//RACK
#define _CTR_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
typedef unsigned long long ll;
constexpr ll mod = 1e9 + 7;
#include <random>
int main()
{
std::mt19937_64 twist;
std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios_base::sync_with_stdio(0);
ll n, K;
std::cin >> n >> K;
int ind(1);
while (ind--)
{
ll p(0), k((1ll << std::min <ll> (61ll, n)) - 1), s, odp(0), pot(1);
while (k > p)
{
s = (p + k + 1) / 2;
if (K <= s)k = s - 1;
else
{
p = s;
odp = (odp + pot) % mod;
}
pot = (pot * 2) % mod;
}
std::cout << (odp+1)%mod << '\n';
if (ind) {
K = twist() % ll(1e18) + 1;
n = twist() % ll(1e6) + 100;
std::cerr << n <<' '<<K << ' ';
}
}
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... |