Submission #466203

# Submission time Handle Problem Language Result Execution time Memory
466203 2021-08-18T11:07:08 Z Halit Rack (eJOI19_rack) C++17
100 / 100
5 ms 204 KB
// author: Halit
#include <bits/stdc++.h>

int main() {
	int64_t n, k;
	std::cin >> n >> k;

	int64_t res = 1, pow = 1, mod = 1e9 + 7;
	for (int i = 1;i <= n; ++i, (k = (k+1)/2)) {
		if (k % 2 == 0) res = (res<<1|1)%mod;
		else res = (res<<1)%mod;
		pow = (pow * 2) % mod;
	}

	pow = (pow - 1 + mod) % mod;
	res = (res - pow + mod) % mod;

	std::cout << res << std::endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 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 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 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 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 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 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 5 ms 204 KB Output is correct