제출 #1175043

#제출 시각아이디문제언어결과실행 시간메모리
1175043FZ_LaabidiDetecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include "molecules"
using namespace std;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    int sum =0;
    sort(w.begin(), w.end());
    for(int i: w)sum+=i;
    int n = w.size();
    vector<bool> poss(u+1, false);
    poss[0]= true;
    vector<vector<int>> dp(u+1);
    for(int i=0; i<n; i++){
        for(int j=u; j>=w[i]; j--){
            if(poss[j-w[i]]){
                poss[j]= true;
                dp[j]= dp[j-w[i]];
                dp[j].push_back(w[i]);
            }
        }
    }
    for(int i=l; i<=u; i++){
        if(!dp[i].empty())return dp[i];
    }
    return {};
}

컴파일 시 표준 에러 (stderr) 메시지

molecules.cpp:4:6: error: 'vector' in namespace 'std' does not name a template type
    4 | std::vector<int> find_subset(int l, int u, std::vector<int> w) {
      |      ^~~~~~
molecules.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include "molecules"
  +++ |+#include <vector>
    2 | using namespace std;
molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~