Submission #742090

# Submission time Handle Problem Language Result Execution time Memory
742090 2023-05-15T15:17:04 Z bogdanvladmihai Rack (eJOI19_rack) C++14
40 / 100
1 ms 268 KB
#include <iostream>
#include <vector>

const int M = 1e9 + 7;

int main() {
    int N;
    int64_t K;
    std::cin >> N >> K;
    K--;
    std::vector<int> pow(63, 1);
    for (size_t i = 1; i < pow.size(); i++) {
        pow[i] = pow[i - 1] + pow[i - 1];
        if (pow[i] >= M) {
            pow[i] -= M;
        }
    }
    int answer = 0;
    for (int i = 0; i < 63; i++) {
        if ((K & (1LL << (int64_t)i)) > 0) {
            answer += pow[N - i - 1];
            if (answer >= M) {
                answer -= M;
            }
        }
    }
    std::cout << answer + 1 << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 268 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Incorrect 1 ms 212 KB Output isn't correct
13 Halted 0 ms 0 KB -