Submission #379623

#TimeUsernameProblemLanguageResultExecution timeMemory
379623Pichon5Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> #define vi vector<int> #define pb push_back #define F first #define S second 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; res.pb(v[i].S); 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:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:16:5: error: 'll' was not declared in this scope; did you mean 'l'?
   16 |     ll sum=0;
      |     ^~
      |     l
molecules.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:18:9: error: 'sum' was not declared in this scope
   18 |         sum+=v[i].F;
      |         ^~~
molecules.cpp:24:17: error: 'L' was not declared in this scope
   24 |         if(sum>=L && sum<=u){
      |                 ^