Submission #384529

#TimeUsernameProblemLanguageResultExecution timeMemory
384529AlexRex0Detecting Molecules (IOI16_molecules)C++14
9 / 100
2 ms384 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> res; vector< pair<int, int> > arre; pair<int, int> aux; vector<int> find_subset(int l, int u, vector<int> w) { long long int ini = 0, fin = 0, suma = 0; for(int i = 0; i < w.size(); ++i){ aux.first = w[i]; aux.second = i; arre.push_back(aux); } sort(arre.begin(), arre.end()); while(fin < arre.size() && ini < arre.size()){ if(suma < l && fin < arre.size()){ suma+= arre[fin].first; fin++; }else{ suma-= arre[ini].first; ini++; } if(suma >= l && suma <= u){ for(int i = ini; i <= fin - 1; ++i){ res.push_back(arre[i].second); } break; } } return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i = 0; i < w.size(); ++i){
      |                    ~~^~~~~~~~~~
molecules.cpp:17:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     while(fin < arre.size() && ini < arre.size()){
      |           ~~~~^~~~~~~~~~~~~
molecules.cpp:17:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     while(fin < arre.size() && ini < arre.size()){
      |                                ~~~~^~~~~~~~~~~~~
molecules.cpp:18:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         if(suma < l && fin < arre.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...