# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108000 | 2019-04-26T18:25:02 Z | FiloSanza | Detecting Molecules (IOI16_molecules) | C++14 | 4 ms | 384 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> build(multiset<int>& el, const vector<int>& w){ vector<int> sol; for(int i=0; i<w.size(); i++)if(el.count(w[i])){ el.erase(el.find(w[i])); sol.push_back(i); } return sol; } vector<int> find_subset(int l, int u, vector<int> w) { sort(w.begin(), w.end()); long long sum = 0; multiset<int> el; for(auto i : w) sum += 1LL*i, el.insert(i); while(!el.empty()){ if(sum < l) return vector<int>(0); if(sum >= l && sum <= u) return build(el, w); long long diff = sum - u; auto it = el.lower_bound(diff); if(it == el.end()) it = prev(el.end()); sum -= *it; el.erase(it); } return vector<int>(0); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 384 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 384 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 384 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 384 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 384 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
7 | Correct | 4 ms | 384 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 384 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 384 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |