Submission #424931

#TimeUsernameProblemLanguageResultExecution timeMemory
424931Ahmadsm2005Detecting Molecules (IOI16_molecules)C++14
100 / 100
57 ms6164 KiB
#include "molecules.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; vector<int>find_subset(int l,int u,vector<int>w){ vector<int>ANS; long long SUM=0; int L=0; vector<pair<int,int>>CRAP; for(int i=0;i<w.size();i++) CRAP.push_back({w[i],i}); sort(CRAP.begin(),CRAP.end()); for(int i=0;i<w.size();i++){ SUM+=CRAP[i].first; while(SUM>u) SUM-=CRAP[L].first,L++; if(SUM>=l&&SUM<=u){ for(int l=L;l<=i;l++) ANS.push_back(CRAP[l].second); return ANS; } } return ANS; }

Compilation message (stderr)

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