Submission #65963

#TimeUsernameProblemLanguageResultExecution timeMemory
65963gs13068Detecting Molecules (IOI16_molecules)C++17
100 / 100
94 ms9736 KiB
#include "molecules.h" #include <algorithm> using namespace std; pair<int, int> a[200002]; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> r; long long L, U; int i, j, k, n; n = w.size(); for (i = 0; i < n; i++) { a[i].first = w[i]; a[i].second = i; } sort(a, a + n); L = U = 0; for (i = 0; i < n; i++) { L += a[i].first; U += a[n - i - 1].first; if (L <= u && l <= U) break; } if (i == n) return r; for (j = 0; L < l; j++) { L -= a[j].first; L += a[j + i + 1].first; } for (k = 0; k <= i; k++) r.push_back(a[j + k].second); return r; }
#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...