Submission #949792

#TimeUsernameProblemLanguageResultExecution timeMemory
949792Rainmaker2627Detecting Molecules (IOI16_molecules)C++17
0 / 100
1064 ms436 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll s=0; int lo=0, hi=0; vector<int> ans(0); vector<pair<int, int>> t; for (int i = 0; i < w.size(); ++i) t.emplace_back(w[i], i); sort(t.begin(), t.end()); while (lo<w.size()) { if (hi<w.size() && s<l) s+=w[hi++]; if (lo<w.size() && u<s) s-=w[lo++]; if (l<=s && s<=u) { for (int i = lo; i < hi; ++i) ans.push_back(t[i].second); break; } } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:11:20: 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) t.emplace_back(w[i], i);
      |                  ~~^~~~~~~~~~
molecules.cpp:13:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  while (lo<w.size()) {
      |         ~~^~~~~~~~~
molecules.cpp:14:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   if (hi<w.size() && s<l) s+=w[hi++];
      |       ~~^~~~~~~~~
molecules.cpp:15:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   if (lo<w.size() && u<s) s-=w[lo++];
      |       ~~^~~~~~~~~
#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...