Submission #774640

#TimeUsernameProblemLanguageResultExecution timeMemory
774640Sandarach151Detecting Molecules (IOI16_molecules)C++17
9 / 100
0 ms212 KiB
#include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); int pos1 = 0; int pos2 = 0; long long cursum = w[0]; vector<int> ans; bool res = true; while(true){ if(cursum<l){ pos2++; if(pos2<w.size()){ cursum+=w[pos2]; } else{ res = false; break; } } else if(cursum>u){ cursum-=w[pos1]; pos1++; if(pos1>pos2){ res = false; break; } } else{ break; } } if(res==false){ return ans; } else{ for(int i=pos1; i<=pos2; i++){ ans.push_back(i); } return ans; } }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |             if(pos2<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...