Submission #963185

#TimeUsernameProblemLanguageResultExecution timeMemory
963185maxFedorchukDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms352 KiB
#include <bits/stdc++.h> using namespace std; //#include "molecules.h" vector<int> find_subset(const int l,const int u,const vector<int> w) { vector < pair < int ,int > > mas; vector < int > ans; for(int i=0;i<w.size();i++) { mas.push_back({w[i],i+1}); } sort(mas.begin(),mas.end()); for(int sum=0,ru=0,lu=0;ru<w.size();ru++) { sum+=mas[ru].first; while(sum>u) { sum-=mas[lu].first; lu++; } if(sum>=l) { for(int j=lu;j<=ru;j++) { ans.push_back(mas[j].second); } break; } } return ans; }

Compilation message (stderr)

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