Submission #957441

#TimeUsernameProblemLanguageResultExecution timeMemory
957441rahidilbayramliRack (eJOI19_rack)C++17
100 / 100
2 ms460 KiB
#pragma GCC optimize("-O3") #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define p_b pop_back #define f first #define s second using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const ll mod = 1e9+7; ll binpow(ll a, ll b) { ll res = 1; while(b) { if(b & 1) res = res * a % mod; a = a * a % mod; b >>= 1; } return res; } void solve() { ll n, k, i, ans = 1, e, x; cin >> n >> k; for(i = n - 1; i >= 0; i--) { if(k % 2 == 0) { ans += binpow(2, i); ans %= mod; } k = (k + 1) / 2; } cout << ans << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll tests = 1; //cin >> tests; while(tests--) { solve(); } }

Compilation message (stderr)

rack.cpp: In function 'void solve()':
rack.cpp:35:26: warning: unused variable 'e' [-Wunused-variable]
   35 |     ll n, k, i, ans = 1, e, x;
      |                          ^
rack.cpp:35:29: warning: unused variable 'x' [-Wunused-variable]
   35 |     ll n, k, i, ans = 1, e, x;
      |                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...