Submission #448353

# Submission time Handle Problem Language Result Execution time Memory
448353 2021-07-29T19:25:58 Z mychecksedad Rack (eJOI19_rack) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD (1000000000+7)

ll fp(ll a, ll b){
    ll res = 1;
    while(b){
        if(b&1) (res*=a)%=MOD;
        (a*=a)%=MOD;
        b>>=1;
    }
    return res;
}


int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    ll n, k, ans=1;
    cin >> n >> k;
    for(ll i = n-1; i > 0; i--){
        if(k&1){
            k = (k>>1) + 1;
        }else{
            k >>= 1;
            ans += fp(2, i);
        }
        (ans%=MOD);
        (ans+=MOD)%=MOD;
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -