Submission #939466

#TimeUsernameProblemLanguageResultExecution timeMemory
939466ifateenDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms440 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> ans; vector<pair<int, int>> arr(w.size()); for (size_t i = 0; i < w.size(); i++) { arr[i] = {w[i], i}; } sort(begin(arr), end(arr)); size_t R = 0; long long sum = arr[0].first; for (size_t L = 0; L < w.size(); L++) { if (R < L) { R = L; sum = arr[R].first; } while (R + 1 < w.size() && sum + arr[R + 1].first <= u) sum += arr[++R].first; if (sum >= l && sum <= u) { for (size_t s = L; s <= R; s++) ans.push_back(arr[s].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...