제출 #639969

#제출 시각아이디문제언어결과실행 시간메모리
639969rc_catuntaDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms216 KiB
#include "molecules.h" #include <vector> #include <algorithm> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { // Desempaquetar en un vector de pairs vector< pair<int,int> > v; for(int i=0;i<w.size();i++){ v.push_back(make_pair(w[i],i)); } sort(v.begin(),v.end()); vector<int> res; int suma = 0; // Probemos de menor a mayor for(int i=0;i<v.size();i++){ suma += v[i].first; res.push_back(v[i].second); if(suma>=l and suma<=u) return res; } suma = 0; res.clear(); for(int i=v.size()-1;i>=0;i--){ suma += v[i].first; res.push_back(v[i].second); if(suma>=l and suma<=u) return res; } res.clear(); return res; }

컴파일 시 표준 에러 (stderr) 메시지

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