Submission #464886

# Submission time Handle Problem Language Result Execution time Memory
464886 2021-08-14T11:29:44 Z ewirlan Rack (eJOI19_rack) C++14
0 / 100
1000 ms 5228 KB
//RACK

#define _CTR_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
typedef long long ll;
template <typename T> T in()
{
    T x;
    std::cin >> x;
    return x;
}
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(in<ll>());
    ll K(in<ll>());
    int ind(1);
    while (1)
    {
        ll p(0), k((1ll << std::min(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
1 Execution timed out 1085 ms 5228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 5228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 5228 KB Time limit exceeded
2 Halted 0 ms 0 KB -