# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1229186 | 1zaid1 | Rack (eJOI19_rack) | Pypy 3 | 206 ms | 55116 KiB |
M = 1000000007
def p(n):
if n == 0: return 1
if n%2 == 1: return 2*p(n-1)%M
a = p(n/2)
return a*a%M
def f(n, x):
if (n == 0):
return x
if x%2 == 1:
return f(n-1, (x+1)//2)
else:
return (p(n) + f(n-1, x//2))%M
k, x = input().split(' ')
x = int(x)
k = int(k)
print(f(k-1, x))
Compilation message (stdout)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |