Submission #1088126

#TimeUsernameProblemLanguageResultExecution timeMemory
1088126LucasLeDetecting Molecules (IOI16_molecules)C++17
0 / 100
0 ms440 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; const int INF = 2e9; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pair<int, int>> v; int n = (int)w.size(); for (int i = 0; i < n; ++i) v.push_back({w[i], i}); v.push_back({INF, n}); sort(v.begin(), v.end()); int pref = 0, suff = 0; for (int i = 0; i < n; ++i) { pref += v[i].first; suff += v[n - 1 - i].first; if (pref <= u && suff >= l) { vector<int> res; for (int j = i; j < n; ++j) { if (pref >= l) { for (int k = j - i; k <= j; ++k) res.push_back(v[k].second + 1); return res; } pref += v[j + 1].first - v[j - i].first; } } } return vector<int>(); }
#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...