Submission #532587

#TimeUsernameProblemLanguageResultExecution timeMemory
532587PsiolixUKRack (eJOI19_rack)C++14
40 / 100
1 ms312 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr int MOD = 1e9 + 7; main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; int pow = 1; int odp = 1; cin >> n >> k; --k; for(int i = 0; i < n; ++i) { if(k%2) { odp = (2 * odp + 1) % MOD; } else { odp = (2 * odp) % MOD; } k /= 2; } for(int i = 0; i < n; ++i) pow = ((ll)pow * 2) % MOD; cout << (odp - pow + 1 + MOD) % MOD; }

Compilation message (stderr)

rack.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...