Submission #282149

#TimeUsernameProblemLanguageResultExecution timeMemory
282149Pichon5Detecting Molecules (IOI16_molecules)C++17
69 / 100
1094 ms4076 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){ vector<pair<int,int> >v; for(int i=0;i<w.size();i++){ v.push_back({w[i],i}); } sort(v.begin(),v.end()); vi res; for(int i=0;i<w.size();i++){ int sum=0; for(int ll=i;ll<w.size();ll++){ sum+=v[ll].first; if(sum>=l && sum<=u){ for(int ii=i;ii<=ll;ii++){ res.push_back(v[ii].second); } return res; } if(sum>u){ break; } } } ///4 15 17 6 8 8 7 return vector<int>(); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
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:14:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int ll=i;ll<w.size();ll++){
      |                      ~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...