# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
196899 | 2020-01-17T14:51:09 Z | Juney | Detecting Molecules (IOI16_molecules) | C++14 | 7 ms | 400 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; vector<pii> v; for(int i=0; i<w.size(); i++) v.push_back(pii(w[i], i)); sort(v.begin(), v.end(), greater<pii>()); ll sum = 0; for(int i=0; i<v.size(); i++) { sum += v[i].first; ans.push_back(v[i].second); if(sum >= l) { if(sum <= u) return ans; int k = 0; for(int j=i+1; j<v.size() && k<ans.size(); j++) { sum -= w[ans[k]]; sum += w[v[j].second]; ans[k] = v[j].second; k++; if(sum <= u) return ans; } while(!ans.empty()) { sum -= w[ans.back()]; ans.pop_back(); if(sum < l) return vector<int>(); if(sum <= u) return ans; } return vector<int> (); } } return vector<int> (); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 400 KB | OK (n = 1, answer = NO) |
2 | Correct | 7 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 3 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 | 252 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
13 | Correct | 1 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 248 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 252 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 376 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
2 | Correct | 3 ms | 376 KB | OK (n = 12, answer = YES) |
3 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 2 ms | 376 KB | OK (n = 12, answer = NO) |
5 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
6 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
7 | Correct | 4 ms | 376 KB | OK (n = 12, answer = YES) |
8 | Correct | 1 ms | 376 KB | OK (n = 12, answer = YES) |
9 | Correct | 0 ms | 256 KB | OK (n = 6, answer = YES) |
10 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
11 | Correct | 2 ms | 376 KB | OK (n = 100, answer = NO) |
12 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
13 | Correct | 3 ms | 376 KB | OK (n = 100, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
15 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 400 KB | OK (n = 1, answer = NO) |
2 | Correct | 7 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 3 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 | 252 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
13 | Correct | 1 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 248 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 252 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 376 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
21 | Correct | 3 ms | 376 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 376 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
26 | Correct | 4 ms | 376 KB | OK (n = 12, answer = YES) |
27 | Correct | 1 ms | 376 KB | OK (n = 12, answer = YES) |
28 | Correct | 0 ms | 256 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 376 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 376 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
34 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 400 KB | OK (n = 1, answer = NO) |
2 | Correct | 7 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 3 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 | 252 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
13 | Correct | 1 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 248 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 252 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 376 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
21 | Correct | 3 ms | 376 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 376 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
26 | Correct | 4 ms | 376 KB | OK (n = 12, answer = YES) |
27 | Correct | 1 ms | 376 KB | OK (n = 12, answer = YES) |
28 | Correct | 0 ms | 256 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 376 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 376 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
34 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 400 KB | OK (n = 1, answer = NO) |
2 | Correct | 7 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 3 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 | 252 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
13 | Correct | 1 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 248 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 252 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 376 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
21 | Correct | 3 ms | 376 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 376 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
26 | Correct | 4 ms | 376 KB | OK (n = 12, answer = YES) |
27 | Correct | 1 ms | 376 KB | OK (n = 12, answer = YES) |
28 | Correct | 0 ms | 256 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 376 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 376 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
34 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
35 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 400 KB | OK (n = 1, answer = NO) |
2 | Correct | 7 ms | 376 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 256 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 256 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 376 KB | OK (n = 3, answer = YES) |
7 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
8 | Correct | 3 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 | 252 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 376 KB | OK (n = 3, answer = YES) |
13 | Correct | 1 ms | 376 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 256 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 256 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 376 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 248 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 252 KB | OK (n = 100, answer = NO) |
19 | Correct | 3 ms | 376 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
21 | Correct | 3 ms | 376 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 376 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
25 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
26 | Correct | 4 ms | 376 KB | OK (n = 12, answer = YES) |
27 | Correct | 1 ms | 376 KB | OK (n = 12, answer = YES) |
28 | Correct | 0 ms | 256 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 376 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
32 | Correct | 3 ms | 376 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 256 KB | OK (n = 100, answer = YES) |
34 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
35 | Halted | 0 ms | 0 KB | - |