Submission #993515

# Submission time Handle Problem Language Result Execution time Memory
993515 2024-06-05T22:18:32 Z lazar3141 Rack (eJOI19_rack) C++14
100 / 100
6 ms 8300 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long

int md = 1e9+7;

void solve(){
    int n, k;cin>>n>>k;
    vector<int> v(1e6+10);
    v[0] = 1;
    for(int i = 1;i<1e6+10;i++) v[i] = (v[i-1]*2)%md;
    int ans = 0;
    while(k>1){
        if(k%2==0) ans+=v[n-1];
        ans%=md;
        k = (k+1)/2;
        n--;
    }
    ans++;
    ans%=md;
    cout<<ans<<endl;
}

int32_t main(){
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8132 KB Output is correct
3 Correct 6 ms 8280 KB Output is correct
4 Correct 6 ms 8284 KB Output is correct
5 Correct 6 ms 8300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8132 KB Output is correct
3 Correct 6 ms 8280 KB Output is correct
4 Correct 6 ms 8284 KB Output is correct
5 Correct 6 ms 8300 KB Output is correct
6 Correct 6 ms 8280 KB Output is correct
7 Correct 6 ms 8284 KB Output is correct
8 Correct 5 ms 8284 KB Output is correct
9 Correct 5 ms 8284 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8280 KB Output is correct
2 Correct 5 ms 8132 KB Output is correct
3 Correct 6 ms 8280 KB Output is correct
4 Correct 6 ms 8284 KB Output is correct
5 Correct 6 ms 8300 KB Output is correct
6 Correct 6 ms 8280 KB Output is correct
7 Correct 6 ms 8284 KB Output is correct
8 Correct 5 ms 8284 KB Output is correct
9 Correct 5 ms 8284 KB Output is correct
10 Correct 5 ms 8284 KB Output is correct
11 Correct 6 ms 8280 KB Output is correct
12 Correct 6 ms 8284 KB Output is correct
13 Correct 6 ms 8284 KB Output is correct
14 Correct 6 ms 8112 KB Output is correct
15 Correct 5 ms 8284 KB Output is correct