Submission #883225

# Submission time Handle Problem Language Result Execution time Memory
883225 2023-12-04T20:00:47 Z DrAymeinstein Rack (eJOI19_rack) C++17
40 / 100
1 ms 348 KB
// European Junior Olympiad in Informatics 2019
// Maribor, Slovenia, Day 1: rack

#include <iostream>

using namespace std;

const long int mod = 1000000007;

int n,k,i,r = 1;

int pow2(int x) {
    if (!x) {
        return 1;
    }
    if (x & 1) {
        return 2 * pow2(x / 2) % mod * pow2(x / 2) % mod;
    }
    return (pow2(x / 2) * pow2(x / 2) % mod);
}

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

    for (i = n - 1; i >= 0; i--) {
        if (k & 1) k++;
        else r = (r + pow2(i)) % mod;
        k = (k + 1) / 2;
    }
    cout << r << endl;

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