# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102031 | 2019-03-21T19:06:05 Z | joylintp | Detecting Molecules (IOI16_molecules) | C++17 | 3 ms | 384 KB |
#include<bits/stdc++.h> #include"molecules.h" using namespace std; pair<long long, int> ms[200000] = {}; vector<int> find_subset(int l, int u, vector<int> w) { int amount = w.size(), i; for (i = 0; i < w.size(); i++) ms[i].second = i, ms[i].first = (long long)w[i]; sort(ms, ms + amount); long long now = 0; vector<int> ans; i = 0; while (now < l && i < amount) now += ms[i++].first; if (now < l) return ans; else if (now <= u) { for (int j = 0; j < i; j++) ans.push_back(ms[j].second); return ans; } else { int lans = 0, rans = i - 1; now -= ms[i - 1].first; if (now == 0) if (ms[0].first > u) return ans; else { ans.push_back(ms[0].second); return ans; } while (rans + 1 < amount && now < l) now = now - ms[lans].first + ms[rans + 1].first, rans++, lans++; if (now > u || now < l) return ans; else { for (int i = lans + 1; i <= rans; i++) ans.push_back(ms[i].second); 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 | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
11 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
2 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
3 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
5 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
6 | Incorrect | 2 ms | 384 KB | Contestant can not find answer, jury can |
7 | 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 | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
11 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 2 ms | 384 KB | Contestant can not find answer, jury can |
26 | 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 | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
11 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 2 ms | 384 KB | Contestant can not find answer, jury can |
26 | 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 | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
11 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 2 ms | 384 KB | Contestant can not find answer, jury can |
26 | 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 | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 384 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 | 2 ms | 384 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
11 | Correct | 3 ms | 384 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 384 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 384 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 256 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 256 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 384 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 384 KB | OK (n = 12, answer = YES) |
25 | Incorrect | 2 ms | 384 KB | Contestant can not find answer, jury can |
26 | Halted | 0 ms | 0 KB | - |