Submission #438413

#TimeUsernameProblemLanguageResultExecution timeMemory
438413NintsiChkhaidzeRack (eJOI19_rack)C++14
100 / 100
10 ms7884 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define left (node<<1),l,((l+r)>>1) #define right ((node<<1)|1),((l+r)>>1) + 1,r #define s second #define f first #define pii pair<int,int> #define mod 1000000007 using namespace std; const int N = 1000005; ll pwr[N]; int main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); ll n,k; cin>>n>>k; pwr[0] = 1; for (int i = 1; i <= n; i++) pwr[i] = (pwr[i - 1]*2)%mod; ll ans = 1; while (n){ if (!(k%2)) ans = (pwr[n - 1] + ans)%mod; n--; k = (k + 1)/2; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...