Submission #432385

# Submission time Handle Problem Language Result Execution time Memory
432385 2021-06-18T08:59:15 Z Dakto Rack (eJOI19_rack) C++17
100 / 100
45 ms 30748 KB
#include <bits/stdc++.h>

using namespace std;

const long long mod=1e9+7;

long long solve(long long n, long long k){
    if(n==0) return 0;
    if(log2(k)<=n-1) return (2*solve(n-1,k))%mod;
    else return (2*solve(n-1, k-(1ll<<(n-1)))+1)%mod;
}

int main(){
    long long n,k;
    cin>>n>>k;
    cout<<(solve(n,k)+1)%mod<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 252 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 252 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 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 252 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 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 460 KB Output is correct
14 Correct 4 ms 1996 KB Output is correct
15 Correct 45 ms 30748 KB Output is correct