Submission #773369

#TimeUsernameProblemLanguageResultExecution timeMemory
773369MatblubeDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(w.begin(), w.end()); int n=w.size(); int a, b, cc, pos;x std::vector<int>result; a=b=cc=pos=0; while(1){ if(b>=n || a>=n) break; if(cc<l){ cc+=w[a++]; continue; } if(cc>u){ cc-=w[b++]; continue; } for(int i=a; i<b ; i++){ result.push_back(w[i]); } return result; } return std::vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:23: error: 'x' was not declared in this scope
    9 |     int a, b, cc, pos;x
      |                       ^
molecules.cpp:21:13: error: 'result' was not declared in this scope
   21 |             result.push_back(w[i]);
      |             ^~~~~~
molecules.cpp:23:16: error: 'result' was not declared in this scope
   23 |         return result;
      |                ^~~~~~