제출 #1114572

#제출 시각아이디문제언어결과실행 시간메모리
1114572lftroqDetecting Molecules (IOI16_molecules)C++14
컴파일 에러
0 ms0 KiB
#include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(),w.end()); long long s=0; for(int i=0;i<(int)w.size();i++) { s+=w[i]; while(s>u) s-=w[j++]; if(s>=l) { vector<int> ans; for(int k=j;k<=i;k++) ans.push_back(k); return ans; } } return {}; }

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

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |     sort(w.begin(),w.end());
      |     ^~~~
      |     short
molecules.cpp:11:25: error: 'j' was not declared in this scope
   11 |         while(s>u) s-=w[j++];
      |                         ^
molecules.cpp:15:23: error: 'j' was not declared in this scope
   15 |             for(int k=j;k<=i;k++) ans.push_back(k);
      |                       ^