답안 #464863

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464863 2021-08-14T10:39:34 Z ewirlan Rack (eJOI19_rack) C++17
0 / 100
1 ms 204 KB
//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 };
int main()
{
    std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios_base::sync_with_stdio(0);
    int n(in<int>()), k(in<int>());
    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)wek.push_back((i + pow2[j]) % mod);
    }
    std::cout << wek[k - 1] << '\n';
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:23:23: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     while (wek.size() < k)
      |            ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -