# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61058 | 2018-07-25T07:14:25 Z | Tenuun | Detecting Molecules (IOI16_molecules) | C++17 | 3 ms | 584 KB |
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int>res; vector<pair<int, int> >v; for(int i=0; i<w.size(); i++){ v.push_back({w[i], i}); } sort(v.rbegin(), v.rend()); long long curr=0; int r=0; for(int i=0; i<v.size(); i++){ r=max(r, i); if(i==r){ curr=v[i].first; res.clear(); res.push_back(v[i].second); } while(r+1<v.size() && curr<l){ curr+=v[r+1].first; res.push_back(v[r+1].second); r++; } if(curr>=l && curr<=u) return res; while(res.size() && curr>u){ curr-=v[i].first; swap(*res.begin(), *res.end()); res.pop_back(); } } if(curr>=l && curr<=u) return res; else return res={}, res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | OK (n = 1, answer = NO) |
2 | Correct | 3 ms | 356 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 356 KB | OK (n = 1, answer = YES) |
4 | Correct | 3 ms | 432 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 516 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
13 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 1 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 1 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 584 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 584 KB | sum of weights should be in [302..304] but it is 305 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | OK (n = 1, answer = NO) |
2 | Correct | 3 ms | 356 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 356 KB | OK (n = 1, answer = YES) |
4 | Correct | 3 ms | 432 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 516 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
13 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 1 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 1 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 584 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 584 KB | sum of weights should be in [302..304] but it is 305 |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | OK (n = 1, answer = NO) |
2 | Correct | 3 ms | 356 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 356 KB | OK (n = 1, answer = YES) |
4 | Correct | 3 ms | 432 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 516 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
13 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 1 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 1 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 584 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 584 KB | sum of weights should be in [302..304] but it is 305 |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | OK (n = 1, answer = NO) |
2 | Correct | 3 ms | 356 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 356 KB | OK (n = 1, answer = YES) |
4 | Correct | 3 ms | 432 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 516 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
13 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 1 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 1 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 584 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 584 KB | sum of weights should be in [302..304] but it is 305 |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | OK (n = 1, answer = NO) |
2 | Correct | 3 ms | 356 KB | OK (n = 1, answer = NO) |
3 | Correct | 3 ms | 356 KB | OK (n = 1, answer = YES) |
4 | Correct | 3 ms | 432 KB | OK (n = 2, answer = YES) |
5 | Correct | 3 ms | 516 KB | OK (n = 2, answer = YES) |
6 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
12 | Correct | 3 ms | 536 KB | OK (n = 3, answer = YES) |
13 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 1 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 3 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 1 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 3 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 584 KB | OK (n = 100, answer = YES) |
20 | Incorrect | 2 ms | 584 KB | sum of weights should be in [302..304] but it is 305 |
21 | Halted | 0 ms | 0 KB | - |