Submission #919276

# Submission time Handle Problem Language Result Execution time Memory
919276 2024-01-31T14:04:59 Z raphaelp Rack (eJOI19_rack) C++14
100 / 100
6 ms 8280 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long N, K;
    cin >> N >> K;
    K--;
    long long x = 1;
    long long MOD = 1000000007;
    vector<long long> power(N);
    long long base = 1;
    for (long long i = 0; i < N; i++)
    {
        power[i] = base;
        base *= 2;
        base = base % MOD;
    }
    for (long long i = 0; i < N; i++)
    {
        if (K % 2)
        {
            x = (x + power[N - i - 1]) % MOD;
        }
        K /= 2;
    }
    cout << x;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 6 ms 8280 KB Output is correct