Submission #379622

#TimeUsernameProblemLanguageResultExecution timeMemory
379622Pichon5Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define vi vector<int> using namespace std; vector<int> find_subset(int l, int u,vector<int> w){ vi res; vector<pair<int,int> >v; for(int i=0;i<w.size();i++){ v.pb({w[i],i+1}); } sort(w.begin(),w.end()); ll sum=0; for(int i=0;i<w.size();i++){ sum+=v[i].F; if(sum>u){ res.clear(); return res; } if(sum>=L && sum<=u){ return res; } } res.clear(); return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:10:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   10 |         v.pb({w[i],i+1});
      |           ^~
molecules.cpp:13:5: error: 'll' was not declared in this scope; did you mean 'l'?
   13 |     ll sum=0;
      |     ^~
      |     l
molecules.cpp:14:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:15:9: error: 'sum' was not declared in this scope
   15 |         sum+=v[i].F;
      |         ^~~
molecules.cpp:15:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'F'
   15 |         sum+=v[i].F;
      |                   ^
molecules.cpp:20:17: error: 'L' was not declared in this scope
   20 |         if(sum>=L && sum<=u){
      |                 ^