# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299125 | 2020-09-14T13:51:19 Z | azatega | Detecting Molecules (IOI16_molecules) | C++11 | 0 ms | 288 KB |
#include "molecules.h" #include <vector> #include <algorithm> using namespace std; #define ll long long vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<ll, int>> new_w; ll tot_sum = 0; for(int i = 0; i < w.size(); i++){ tot_sum += w[i]; new_w.push_back({w[i], i}); } sort(new_w.begin(), new_w.end()); ll currsum = 0; int tot_sum_idx = 0; for(int i = 0; i < new_w.size(); i++){ currsum += new_w[i].first; while(tot_sum_idx <= i || (tot_sum_idx < new_w.size() && tot_sum+currsum > u)){ tot_sum -= new_w[tot_sum_idx].second; tot_sum_idx++; } if(tot_sum + currsum >= l && tot_sum + currsum <= u){ vector<int> res; for(int x = 0; x <= i; x++) res.push_back(new_w[x].second); for(int x = tot_sum_idx; x < new_w.size(); x++) res.push_back(new_w[x].second); return res; } } vector<int> bl; return bl; } /*int main(){ int n, l, u; vector<int> niz; cin >> n >> l >> u; niz.resize(n); for(int i = 0; i < n; i++) cin >> niz[i]; vector<int> rs = find_subset(l, u, niz); for(int i = 0; i < rs.size(); i++) cout << rs[i] << endl; }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 288 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 288 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 288 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 288 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 288 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 256 KB | Contestant can not find answer, jury can |
4 | Halted | 0 ms | 0 KB | - |