답안 #721848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721848 2023-04-11T07:52:19 Z kas_s Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

int main () {
    ios::sync_with_stdio(0); cin.tie(0);
    int M, L;
    cin >> M >> L;
    map<int, int> sums;
    sums[0] = 0;
    vector<int> a;
    for (int i = -M, x; i <= M; i++) {
        cin >> x;
        for (int j = 0; j < x; j++) {
            a.push_back(i);
        }
    }
    int N = (int)a.size();
    for (int i = 0; i < N; i++) {
        map<int, int> curr;
        for (auto &[k, v]: sums) {
            curr[a[i] + k] = max(curr[a[i] + k], v + 1);
        }
        for (auto &[k, v]: curr) {
            sums[k] = max(sums[k], v);
        }
    }
    if (sums.count(L)) {
        cout << sums[L] << '\n';
    } else {
        cout << "impossible\n";
    }
    return 0;
}

Compilation message

interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccTUnFdB.o: in function `main':
interface.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cchhRAYB.o:art.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccTUnFdB.o: in function `main':
interface.cpp:(.text.startup+0x16): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status