Submission #1308716

#TimeUsernameProblemLanguageResultExecution timeMemory
1308716maya_sRack (eJOI19_rack)C++20
100 / 100
1 ms576 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = (1e9 + 7); ll power(ll a, ll b){ if(b == 0) return 1; ll x = (power(a, b / 2)); if(b % 2 == 0) return (x * x) % mod; return (((x * x) % mod) * a) % mod; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); ll n, k; cin >> n >> k; ll x = 0, d = 2; for(ll i = 1; i <= 60; i++){ ll d = (1ll << i); if(k % d > d / 2 || k % d == 0) x += power(2, n-i), x %= mod; } cout << (x+1) % mod; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...