Submission #442090

#TimeUsernameProblemLanguageResultExecution timeMemory
442090tmp_badDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <map> #include <cmath> #include <algorithm> #include <deque> #include <queue> #include <stack> #include <bitset> #include <string> #include <set> #include "grader.cpp" using namespace std; typedef long long ll; vector<int> find_subset(int L, int U, vector<int> w) { sort(w.begin(), w.end()); int l = 0, r = -1; ll sum = 0; vector<int> res; while (r < w.size()) { if (sum >= L && sum <= U) { for (int i = l; i <= r; i++) { res.push_back(w[i]); } break; } if (sum >= L) sum -= w[l++]; else if (sum < L) sum += w[++r]; } return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:23:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  while (r < w.size()) {
      |         ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccElKfHx.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccHb3OJy.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status