# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62400 | 2018-07-28T10:52:58 Z | zubec | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 492 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector <pair<int, int> > vec; for (int i = 0; i < w.size(); i++){ vec.push_back({w[i], i}); } int needL = -1, needR = -1; sort(vec.begin(), vec.end()); vector <pair<ll, int> > vec2; vec2.push_back({0, -1}); ll sum = 0; for (int i = 0; i < vec.size(); i++){ sum += vec[i].first; if (vec[i].first >= l && vec[i].first <= u){ needL = i; needR = i; } auto it = lower_bound(vec2.begin(), vec2.end(), make_pair(-(l-sum), -2)); if (it != vec2.end()){ if (-it->first+sum >= l && -it->first+sum <= u){ needL = it->second+1; needR = i; } } cout << sum << endl; vec2.push_back({sum, i}); } if (needL == -1) return {}; vector <int> ansvec; for (int i = needL; i <= needR; i++) ansvec.push_back(vec[i].second); sort(ansvec.begin(), ansvec.end()); return ansvec; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 492 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Secret is incorrect! |
2 | Halted | 0 ms | 0 KB | - |