Submission #623648

#TimeUsernameProblemLanguageResultExecution timeMemory
623648froxyyRack (eJOI19_rack)C++14
100 / 100
9 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); typedef long long ll;typedef long double ld;typedef pair<int,int> pii; #define F first #define S second #define PB push_back #define MP make_pair const ll mod = 1e9+7, N = 2e6+7, M = 2e6+7, INF = INT_MAX/10; ll powe(ll x, ll y){ x = x%mod, y=y%(mod-1);ll ans = 1;while(y>0){if (y&1){ans = (1ll * x * ans)%mod;}y>>=1;x = (1ll * x * x)%mod;}return ans;} void solve(){ ll n, k; cin >> n >> k; k--; ll v = 1; for(int i=1; i<=n; i++) { if(k%2 == 0) { v = (v*2) % mod; } else v = (v*2 + 1) % mod; k /= 2; } ll pow2 = 1; for(int i=1; i<=n; i++) { pow2 = (pow2*2) % mod; } cout << (v - pow2 + 1 + mod) % mod << '\n'; } signed main(){ fast; int t = 1; //cin >> t; while(t--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...