제출 #1359398

#제출 시각아이디문제언어결과실행 시간메모리
1359398lyra_g13Rack (eJOI19_rack)C++20
100 / 100
3 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;

      if(block%2 == 0)
      block = block/2;
      else
      block = (block + mod)/2;
    }

    cout << ans << "\n";

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