답안 #694073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
694073 2023-02-03T17:24:21 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<int64_t> q;
    q.push_back(m * m * m);
    for (int64_t i = -m; i <= m; i++)
    {
        int64_t a;
        cin >> a;
        vector<int64_t> y;
        for (int64_t const &j : q)
        {
            for (int64_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);
                }
                y.push_back(j);
            }
        }
        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:35: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]
   35 |     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 -