Submission #998701

#TimeUsernameProblemLanguageResultExecution timeMemory
998701The_SamuraiDetecting Molecules (IOI16_molecules)C++17
9 / 100
0 ms348 KiB
#include "molecules.h" #include "bits/stdc++.h" using namespace std; const int N = 5e5 + 5; std::vector<int> find_subset(int l, int r, std::vector<int> w) { int n = w.size(); long long sum = 0; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) a[i] = make_pair(w[i], i); sort(a.begin(), a.end()); for (int lx = 0, rx = 0; rx < w.size(); rx++) { sum += w[rx]; while (sum > r) { sum -= w[lx++]; } if (sum >= l) { vector<int> ans; for (int i = lx; i <= rx; i++) ans.emplace_back(a[i].second); return ans; } } return {}; }

Compilation message (stderr)

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