Submission #599638

#TimeUsernameProblemLanguageResultExecution timeMemory
599638daisy2Detecting Molecules (IOI16_molecules)C++14
100 / 100
48 ms7144 KiB
#include<iostream> #include<algorithm> #include "molecules.h" using namespace std; pair<long long,long long> p[200005]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> r; for(int j=0;j<w.size();j++) { p[j].first=w[j]; p[j].second=j; } sort(p,p+w.size()); long long t=0,le=0; for(int ri=0;ri<w.size();ri++) { t+=p[ri].first; while(le<ri && t>u) { t-=p[le].first; le++; } if(t>=l && t<=u) { for(int i=le;i<=ri;i++) { r.push_back(p[i].second); } break; } } return r; }

Compilation message (stderr)

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