Submission #774491

# Submission time Handle Problem Language Result Execution time Memory
774491 2023-07-05T18:49:00 Z serifefedartar Rack (eJOI19_rack) C++17
0 / 100
1000 ms 8020 KB
#include <bits/stdc++.h>

using namespace std;

#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define mod 1000000007
#define MAXN 1000005

ll n, k;
ll pow2[MAXN];
int main() {
    fast
    pow2[0] = 1;
    for (ll i = 1; i < MAXN; i++)
        pow2[i] = (pow2[i-1] * 2) % mod;
    cin >> n >> k;

    ll ans = 1;
    for (ll i = 2; i <= LLONG_MAX; i*=2) {
        if (k % i == 0 || k % i > i/2)
            ans = (ans + pow2[n-__builtin_ctz(i)]) % mod;
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 8020 KB Time limit exceeded
2 Halted 0 ms 0 KB -