Submission #289186

#TimeUsernameProblemLanguageResultExecution timeMemory
289186NicolaAbusaad2014Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<long> find_subset(long l,long r,vector<long long>w) { vector<pair<long long,long> >x,v; for(long i=0;i<w.size();i++){ x.push_back(make_pair(w[i],i)); } sort(w.begin(),w.end()); vector<long>ans; long long sum=0,now=0; bool ok=false; for(long i=0;i<w.size();i++){ if(sum<l){ sum+=x[i].first; v.push_back(make_pair(x[i].first,x[i].second)); } if(sum>r){ sum-=v[now].first; now++; } if(sum>=l&&sum<=r){ ok=true; break; } } if(ok){ for(long i=now;i<v.size();i++){ ans.push_back(v[i].second); } } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<long int> find_subset(long int, long int, std::vector<long long int>)':
molecules.cpp:9:19: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(long i=0;i<w.size();i++){
      |                  ~^~~~~~~~~
molecules.cpp:16:19: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(long i=0;i<w.size();i++){
      |                  ~^~~~~~~~~
molecules.cpp:31:21: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<std::pair<long long int, long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(long i=now;i<v.size();i++){
      |                    ~^~~~~~~~~
/tmp/ccU68WMr.o: In function `main':
grader.cpp:(.text.startup+0x12b): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status