# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132448 | 2019-07-18T20:52:20 Z | bogdan10bos | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 380 KB |
/// 00:00 , should I call ? #include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long LL; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ord; for(int i = 0; i < w.size(); i++) ord.push_back(i); sort(ord.begin(), ord.end(), [&](int a, int b) { return w[a] < w[b]; } ); vector<LL> sum(w.size()); LL s = 0; for(int i = 0; i < w.size(); i++) { s += w[ ord[i] ]; sum[i] = s; } vector<int> ans; for(int i = 0; i < w.size(); i++) if(l <= sum[i] && sum[i] <= u) { for(int j = 0; j <= i; j++) ans.push_back(ord[j]); sort(ans.begin(), ans.end()); return ans; } for(int i = 0; i < w.size(); i++) if(l <= s - sum[i] && s - sum[i] <= u) { for(int j = (int)w.size() - 1; j > i; j--) ans.push_back(ord[j]); sort(ans.begin(), ans.end()); return ans; } if(l <= s && s <= u) { sort(ord.begin(), ord.end()); return ord; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 348 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 380 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 252 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 252 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 256 KB | Contestant can not find answer, jury can |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 348 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 380 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 252 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 252 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 3 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 348 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 380 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 252 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 252 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 3 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 348 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 380 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 252 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 252 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 3 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 348 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 380 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 252 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 252 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 3 ms | 256 KB | Contestant can not find answer, jury can |
21 | Halted | 0 ms | 0 KB | - |