제출 #956140

#제출 시각아이디문제언어결과실행 시간메모리
956140manishjha91Detecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
std::vector<int> find_subset(int l, int u, std::vector<int> w) { std::vector<pair<int,int>> curr; for(int i=0; i<w.size(); i++) { curr.push_back({w[i],i}); } sort(curr.begin(),curr.end()); long long sum = 0; bool found = 0; int low = 0; int hi = 0; for(; hi<curr.size(); hi++) { sum+=curr[hi].first; while(sum>u) { sum-=curr[low++].first; } if(sum>=l) { found = 1; break; } } if(!found) return std::vector<int>(0); std::vector<int> res; for(int i=low; i<=hi; i++) { res.push_back(curr[i].second); } sort(res.begin(),res.end()); return res; }

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

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