제출 #1217094

#제출 시각아이디문제언어결과실행 시간메모리
1217094moondarksideDetecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
vector<int> find_subset( int l, int u, vector<int> w ) { vector<pair<int,int>> Sorted; for(int i=0;i<w.size();i++){ Sorted.push_back({w[i],i}); } sort(Sorted.begin(),Sorted.end()); if(Sorted[0].first>u){ return vector<int>(); } long long weight=0; std::queue<int> Solution; for(int i=0;i<Sorted.size();i++){ Solution.push(i); weight+=Sorted[i].first; if(weight>=l && weight<=u){ vector<int> Sol; while(!Solution.empty()){ Sol.push_back(Sorted[Solution.front()].second); Solution.pop(); } return Sol; } while (weight > u && !Solution.empty()) { weight -= Sorted[Solution.front()].first; Solution.pop(); } if(weight>=l && weight<=u){ vector<int> Sol; while(!Solution.empty()){ Sol.push_back(Sorted[Solution.front()].second); Solution.pop(); } return Sol; } } return vector<int>(); }

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

molecules.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> find_subset( int l, int u, vector<int> w ) {
      | ^~~~~~
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
      |         ^~~~