Submission #56164

#TimeUsernameProblemLanguageResultExecution timeMemory
56164aquablitz11Detecting Molecules (IOI16_molecules)C++14
100 / 100
92 ms31968 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; using pii = pair<int, int>; using ll = long long; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<pii> W; for (int i = 0; i < n; ++i) W.emplace_back(w[i], i); sort(W.begin(), W.end()); ll sum = 0; int j = 0; vector<int> ans; for (int i = 0; i < n; ++i) { sum += W[i].first; while (sum > u) sum -= W[j++].first; if (sum >= l) { for (int k = j; k <= i; ++k) ans.push_back(W[k].second); break; } } return ans; }
#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...