Submission #774503

# Submission time Handle Problem Language Result Execution time Memory
774503 2023-07-05T19:01:45 Z serifefedartar Rack (eJOI19_rack) C++17
100 / 100
7 ms 8152 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_ctzll(i)]) % mod;
        if (i > k)
            break;
    }
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8020 KB Output is correct
2 Correct 7 ms 8148 KB Output is correct
3 Correct 7 ms 8148 KB Output is correct
4 Correct 7 ms 8148 KB Output is correct
5 Correct 7 ms 8076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8020 KB Output is correct
2 Correct 7 ms 8148 KB Output is correct
3 Correct 7 ms 8148 KB Output is correct
4 Correct 7 ms 8148 KB Output is correct
5 Correct 7 ms 8076 KB Output is correct
6 Correct 7 ms 8148 KB Output is correct
7 Correct 7 ms 8056 KB Output is correct
8 Correct 7 ms 8148 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 7 ms 8096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8020 KB Output is correct
2 Correct 7 ms 8148 KB Output is correct
3 Correct 7 ms 8148 KB Output is correct
4 Correct 7 ms 8148 KB Output is correct
5 Correct 7 ms 8076 KB Output is correct
6 Correct 7 ms 8148 KB Output is correct
7 Correct 7 ms 8056 KB Output is correct
8 Correct 7 ms 8148 KB Output is correct
9 Correct 7 ms 8148 KB Output is correct
10 Correct 7 ms 8096 KB Output is correct
11 Correct 7 ms 8020 KB Output is correct
12 Correct 7 ms 8148 KB Output is correct
13 Correct 7 ms 8148 KB Output is correct
14 Correct 7 ms 8072 KB Output is correct
15 Correct 7 ms 8152 KB Output is correct