Submission #239413

#TimeUsernameProblemLanguageResultExecution timeMemory
239413GREGOIRELCDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define int long long vector<int> find_subset(int l, int u, vector<int> val) { sort(val.begin(), val.end()); int deb = 0, fin = 0; int s = 0; while(fin < val.size() && s < l) { if(s + val[fin] > u) { s -= val[deb]; s += val[fin]; deb++; fin++; } else { s += val[fin]; deb++; fin++; } } vector<int> result; if(s < l || s > u) { return result; } for(int i = deb; i < fin; i++) { result.push_back(val[i]); } return result; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:14:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(fin < val.size() && s < l)
        ~~~~^~~~~~~~~~~~
/tmp/ccRLs7KW.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status