//RACK
#define _CTR_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
typedef long long int ll;
template <typename T> T in()
{
T x;
std::cin >> x;
return x;
}
constexpr int maxn = 1e6 + 3;
constexpr int mod = 1e9 + 7;
ll pow2[maxn]{ 1 };
std::vector <ll> wek{ 1 };
std::vector <ll> wek2;
int main()
{
std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios_base::sync_with_stdio(0);
int n(in<int>());
std::size_t k(in<std::size_t>());
for (int i(1); i < n; ++i)pow2[i] = (pow2[i - 1] * 2) % mod;
int j(n);
while (wek.size() < k)
{
--j;
for (auto i : wek)wek2.push_back((i + pow2[j]) % mod);
for (auto i : wek2)wek.push_back(i);
wek2.clear();
}
std::cout << wek[k - 1] << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 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 |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
1224 KB |
Output is correct |
9 |
Correct |
4 ms |
3512 KB |
Output is correct |
10 |
Correct |
4 ms |
3640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 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 |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
1224 KB |
Output is correct |
9 |
Correct |
4 ms |
3512 KB |
Output is correct |
10 |
Correct |
4 ms |
3640 KB |
Output is correct |
11 |
Runtime error |
140 ms |
102404 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |