Submission #773366

#TimeUsernameProblemLanguageResultExecution timeMemory
773366MatblubeDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <vector> std::vector<int> find_subset(int l, int u, std::vector<int> w) { sort(w.begin(), w.end()); int a, b, cc, pos; 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.pb(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:14:15: error: 'n' was not declared in this scope
   14 |         if(b>=n || a>=n) break;
      |               ^
molecules.cpp:22:20: error: 'class std::vector<int>' has no member named 'pb'
   22 |             result.pb(w[i]);
      |                    ^~