Submission #987460

#TimeUsernameProblemLanguageResultExecution timeMemory
987460mateuszwesDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define pb push_back #define pq priority_queue #define pl pair<ll,ll> #include "molecules.h" using namespace std; constexpr int debug = 0; vector<int> find_subset(int l, int u, vector<int> w){ vector<int> ans; ll sum = 0; ll poc, kon; poc = 0, kon = 0; sort(w.rbegin(), w.rend()); while(kon < w.size()){ sum += w[kon]; //cout << poc << ' ' << kon << ' ' << sum << '\n'; while((sum > u) && (poc <= kon)){ sum -= w[poc]; poc++; } if((sum >= l) && (sum <= u) && (poc <= kon)){ ans.pb(w.size()); /* while(poc <= kon){ ans.pb(w[poc]); poc++; } */ return ans; } kon++; } return ans; } int main(){ vector<int> ann = find_subset(15, 17, {6,7,8,8}); //vector<int> ann = find_subset(0, 0, {10,10,10}); for(auto k: ann) cout << k << ' '; return 0; }

Compilation message (stderr)

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