Submission #1359397

#TimeUsernameProblemLanguageResultExecution timeMemory
1359397lyra_g13Rack (eJOI19_rack)C++20
40 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    ll n , k;
    cin >> n >> k;
    
    ll block =1;
    ll mod = 1000000000 + 7;

    ll ans = 1;
   for(int i = 0 ; i< n-1 ; i++){
    block = (block*2)%mod;
   }
    
    for(int i = 0 ; i < n and k > 1; i++){

      if(k%2 == 0){
        ans = (ans + block + mod)%mod;
      }

      k = (k+1)/2;

      block = block/2;
    }

    cout << ans << "\n";

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...