# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433189 | 2021-06-19T06:38:30 Z | Valaki2 | Rack (eJOI19_rack) | C++14 | 13 ms | 8064 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll mod = 1e9+7; void solve() { ll n, k; cin >> n >> k; --k; vector<ll> powers_of_2_nomodulo(61, 0); vector<ll> powers_of_2(1 + n, 0); powers_of_2[0] = 1; powers_of_2_nomodulo[0] = 1; for(ll i = 1; i <= n; ++i) { powers_of_2[i] = (powers_of_2[i - 1] * 2) % mod; } for(ll i = 1; i <= 60; ++i) { powers_of_2_nomodulo[i] = powers_of_2_nomodulo[i - 1] * 2; } vector<bool> bits_of_k(1 + n, false); ll max_bit_of_k = 0; for(ll i = 0; i <= 60; ++i) { if(k & powers_of_2_nomodulo[i]) { bits_of_k[i] = true; max_bit_of_k = i; } } ll to_add = n - 1; ll where_we_are = 0; ll answer = 1; while(to_add >= 0) { if(bits_of_k[where_we_are]) { answer = (answer + powers_of_2[to_add]) % mod; } ++where_we_are; --to_add; } cout << answer << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 716 KB | Output is correct |
15 | Correct | 13 ms | 8064 KB | Output is correct |