Submission #1045933

# Submission time Handle Problem Language Result Execution time Memory
1045933 2024-08-06T08:36:41 Z mar Rack (eJOI19_rack) C++14
40 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
const int mod=1000000007;
typedef long long ll;

ll dp(ll n, ll k, ll val){
    ll ans = 0;
    if(n== 0)return 0;
    if(n<64){
        ll po = pow(2ull, n-1);
        if(po < k){
            ans+= val;
            ans+= dp(n-1, k-po, val*2);
            return ans;
        }
    }
    ans += dp(n-1, k, val*2);
    return ans;
}

int main(){
    ll n, k;
    cin>>n>>k;
    ll ans = dp(n, k, 1)%mod;
    cout<<ans+1<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -