Submission #382388

#TimeUsernameProblemLanguageResultExecution timeMemory
382388TrunktyDetecting Molecules (IOI16_molecules)C++14
9 / 100
2 ms512 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; long long sum=0; vector<int> find_subset(int li, int ui, vector<int> wi){ long long l=li,u=ui; vector<long long> w={}; for(int i:wi){ w.push_back(i); } sort(w.begin(),w.end()); long long lef=0,rit=-1; while(rit!=w.size()){ rit++; sum += w[rit]; while(sum>u){ sum -= w[lef]; lef++; } if(sum<=u and sum>=l){ vector<int> a = {}; for(int i=lef;i<=rit;i++){ a.push_back(i); } return a; } } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:15:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  while(rit!=w.size()){
      |        ~~~^~~~~~~~~~
#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...