Submission #530100

# Submission time Handle Problem Language Result Execution time Memory
530100 2022-02-24T15:17:46 Z tkwiatkowski Rack (eJOI19_rack) Python 3
100 / 100
322 ms 2844 KB
MOD = 10**9 + 7

def solve():
	n, k = map(int, input().split())
	k -= 1
	ans = 1
	for i in range(n):
		if (k % 2 == 0):
			ans = (2*ans) % MOD
		else:
			ans = (2*ans + 1) % MOD
		k //= 2;

	pow2 = 1
	for i in range(n):
		pow2 = (2*pow2) % MOD
	print((ans - pow2 + 1) % MOD)

solve()
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2764 KB Output is correct
2 Correct 13 ms 2808 KB Output is correct
3 Correct 13 ms 2744 KB Output is correct
4 Correct 14 ms 2828 KB Output is correct
5 Correct 13 ms 2824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2764 KB Output is correct
2 Correct 13 ms 2808 KB Output is correct
3 Correct 13 ms 2744 KB Output is correct
4 Correct 14 ms 2828 KB Output is correct
5 Correct 13 ms 2824 KB Output is correct
6 Correct 13 ms 2788 KB Output is correct
7 Correct 14 ms 2844 KB Output is correct
8 Correct 13 ms 2828 KB Output is correct
9 Correct 19 ms 2716 KB Output is correct
10 Correct 15 ms 2764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 2764 KB Output is correct
2 Correct 13 ms 2808 KB Output is correct
3 Correct 13 ms 2744 KB Output is correct
4 Correct 14 ms 2828 KB Output is correct
5 Correct 13 ms 2824 KB Output is correct
6 Correct 13 ms 2788 KB Output is correct
7 Correct 14 ms 2844 KB Output is correct
8 Correct 13 ms 2828 KB Output is correct
9 Correct 19 ms 2716 KB Output is correct
10 Correct 15 ms 2764 KB Output is correct
11 Correct 12 ms 2720 KB Output is correct
12 Correct 14 ms 2820 KB Output is correct
13 Correct 17 ms 2836 KB Output is correct
14 Correct 31 ms 2796 KB Output is correct
15 Correct 322 ms 2788 KB Output is correct