Submission #453231

# Submission time Handle Problem Language Result Execution time Memory
453231 2021-08-04T09:42:06 Z lukadupli Rack (eJOI19_rack) C++14
40 / 100
5 ms 240 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX = 1e6 + 5, MOD = 1e9 + 7;

int n, sol;
long long k;

bool binary[MAX];

int main()
{
    cin >> n >> k;
    k--;

    for(int i = 0; i < min(n, 59); i++){
        if(k & (1LL << i)) binary[n - i - 1] = 1;
    }

    int pow2 = 1;
    for(int i = 0; i < n; i++){
        if(binary[i]) sol = (sol + pow2) % MOD;
        pow2 = (pow2 * 2) % MOD;
    }

    cout << (sol + 1) % MOD;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 240 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 240 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 240 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Incorrect 5 ms 204 KB Output isn't correct