Submission #789781

#TimeUsernameProblemLanguageResultExecution timeMemory
789781MalixDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int arrSize - w.size(); int gap = u - l; vector<int> answer; vector<int> temp = w; sort(temp.begin(), temp.end()); if(arrSize -- 1){ if(w[0]<=u && w[0]>=l){ return vector<int> l(1, 0); } return std::vector<int>(0); } if(temp[0] == temp[arrSize-1]){ int modval = u%w[0]; if(modval<=gap){ int termcount = (u-modval)/w[0]; if(arrSize>=termcount){ for(int i = 0; i < termcount; i++){ answer.push_back(i); } return answer; } } return std::vector<int>(0); } return std::vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:17: error: expected initializer before '-' token
    6 |     int arrSize - w.size();
      |                 ^
molecules.cpp:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(temp.begin(), temp.end());
      |     ^~~~
      |     short
molecules.cpp:13:8: error: 'arrSize' was not declared in this scope
   13 |     if(arrSize -- 1){
      |        ^~~~~~~
molecules.cpp:13:18: error: expected ')' before numeric constant
   13 |     if(arrSize -- 1){
      |       ~          ^~
      |                  )
molecules.cpp:15:32: error: expected primary-expression before 'l'
   15 |             return vector<int> l(1, 0);
      |                                ^
molecules.cpp:15:31: error: expected ';' before 'l'
   15 |             return vector<int> l(1, 0);
      |                               ^~
      |                               ;
molecules.cpp:15:38: error: 'l' cannot be used as a function
   15 |             return vector<int> l(1, 0);
      |                                      ^
molecules.cpp:20:24: error: 'arrSize' was not declared in this scope
   20 |     if(temp[0] == temp[arrSize-1]){
      |                        ^~~~~~~