답안 #694071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
694071 2023-02-03T17:22:07 Z finn__ Uplifting Excursion (BOI22_vault) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int64_t m, l;
    cin >> m >> l;

    vector<uint64_t> dp1(2 * m * m * m, 0), dp2(2 * m * m * m, 0);
    vector<unsigned> q;
    q.push_back(m * m * m);
    for (int64_t i = -m; i <= m; i++)
    {
        int64_t a;
        cin >> a;
        vector<unsigned> y;
        for (unsigned const &j : q)
        {
            for (size_t k = 1; k <= a; k++)
            {
                if (dp2[j + k * i] < dp1[j] + k)
                {
                    dp2[j + k * i] = dp1[j] + k;
                }
                y.push_back(j + k * i);
            }
        }
        swap(y, q);
        sort(q.begin(), q.end());
        q.resize(unique(q.begin(), q.end()) - q.begin());
        swap(dp1, dp2);
    }

    if (m * m * m + l < dp1.size() && dp1[m * m * m + l])
        cout << dp1[m * m * m + l] << '\n';
    else
        cout << "impossible\n";
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:19:34: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int64_t' {aka 'long int'} [-Wsign-compare]
   19 |             for (size_t k = 1; k <= a; k++)
      |                                ~~^~~~
vault.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<long unsigned int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     if (m * m * m + l < dp1.size() && dp1[m * m * m + l])
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -