# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74170 | 2018-08-30T10:59:52 Z | renatsj | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 748 KB |
#include<bits/stdc++.h> #include "molecules.h" struct masivs{int val;int poz;}; masivs ab[1000006]; using namespace std; int i,j,k,n,m,sum,pref[1000006],suff[1000006]; vector<int> xx; vector<int> xcur,xnew; list<int> vv; bool c1(masivs maz,masivs liel) { if (maz.val==liel.val) { return maz.poz<liel.poz; } return maz.val>liel.val; } vector<int> find_subset(int l, int u, vector<int> w) { n=w.size(); i=0; while (i<n) { ab[i].val=w[i]; ab[i].poz=i; i++; } sort(ab,ab+n,c1); pref[0]=ab[0].val; i=1; while (i<n) { pref[i]=pref[i-1]+ab[i].val; i++; } i=n-1; while (i>=0) { suff[i]=suff[i+1]+ab[i].val; i--; } k=0; while (k<n) { //cout << pref[k] << " " << suff[n-k-1] << "\n"; if (pref[k]>u&&suff[n-k-1]<=l) { i=0; while (i<=k) { sum+=ab[i].val; vv.push_back(ab[i].poz); i++; } j=0; while (sum>u) { sum+=ab[i].val; vv.push_back(ab[i].poz); sum-=ab[j].val; vv.pop_front(); i++; } for (int j:vv) { xx.push_back(j); } return xx; } if (pref[k]<=u&&pref[k]>=l) { i=0; while (i<=k) { sum+=ab[i].val; vv.push_back(ab[i].poz); i++; } for (int j:vv) { xx.push_back(j); } return xx; } if (suff[n-k-1]<=u&&suff[n-k-1]>=l) { i=n-1; sum=0; while (sum<l) { sum+=ab[i].val; xx.push_back(ab[i].poz); i--; } return xx; } k++; } return vector<int>(0); }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 508 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 508 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 576 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 580 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
2 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
3 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
4 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
5 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
6 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
7 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
8 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
9 | Correct | 2 ms | 708 KB | OK (n = 6, answer = YES) |
10 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
11 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
12 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
13 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
14 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
15 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
16 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
17 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 508 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 508 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 576 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 580 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
26 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
27 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 708 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
32 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
34 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
35 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
36 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 748 KB | OK (n = 28, answer = YES) |
38 | Correct | 2 ms | 748 KB | OK (n = 27, answer = YES) |
39 | Correct | 2 ms | 748 KB | OK (n = 90, answer = YES) |
40 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
41 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
42 | Correct | 2 ms | 748 KB | OK (n = 10, answer = YES) |
43 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
44 | Incorrect | 2 ms | 748 KB | sum of weights should be in [990..1000] but it is 1004 |
45 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 508 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 508 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 576 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 580 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
26 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
27 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 708 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
32 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
34 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
35 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
36 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 748 KB | OK (n = 28, answer = YES) |
38 | Correct | 2 ms | 748 KB | OK (n = 27, answer = YES) |
39 | Correct | 2 ms | 748 KB | OK (n = 90, answer = YES) |
40 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
41 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
42 | Correct | 2 ms | 748 KB | OK (n = 10, answer = YES) |
43 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
44 | Incorrect | 2 ms | 748 KB | sum of weights should be in [990..1000] but it is 1004 |
45 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 508 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 508 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 576 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 580 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
26 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
27 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 708 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
32 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
34 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
35 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
36 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 748 KB | OK (n = 28, answer = YES) |
38 | Correct | 2 ms | 748 KB | OK (n = 27, answer = YES) |
39 | Correct | 2 ms | 748 KB | OK (n = 90, answer = YES) |
40 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
41 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
42 | Correct | 2 ms | 748 KB | OK (n = 10, answer = YES) |
43 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
44 | Incorrect | 2 ms | 748 KB | sum of weights should be in [990..1000] but it is 1004 |
45 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 508 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 508 KB | OK (n = 1, answer = YES) |
4 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
5 | Correct | 2 ms | 508 KB | OK (n = 2, answer = YES) |
6 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
7 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
8 | Correct | 2 ms | 508 KB | OK (n = 3, answer = YES) |
9 | Correct | 2 ms | 536 KB | OK (n = 3, answer = YES) |
10 | Correct | 2 ms | 576 KB | OK (n = 3, answer = YES) |
11 | Correct | 2 ms | 580 KB | OK (n = 3, answer = YES) |
12 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
13 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
14 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
15 | Correct | 2 ms | 584 KB | OK (n = 3, answer = YES) |
16 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
17 | Correct | 2 ms | 584 KB | OK (n = 3, answer = NO) |
18 | Correct | 2 ms | 584 KB | OK (n = 100, answer = NO) |
19 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
20 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
21 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
22 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
23 | Correct | 2 ms | 708 KB | OK (n = 12, answer = NO) |
24 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
25 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
26 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
27 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
28 | Correct | 2 ms | 708 KB | OK (n = 6, answer = YES) |
29 | Correct | 2 ms | 708 KB | OK (n = 12, answer = YES) |
30 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
31 | Correct | 2 ms | 708 KB | OK (n = 100, answer = YES) |
32 | Correct | 2 ms | 708 KB | OK (n = 100, answer = NO) |
33 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
34 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
35 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
36 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
37 | Correct | 2 ms | 748 KB | OK (n = 28, answer = YES) |
38 | Correct | 2 ms | 748 KB | OK (n = 27, answer = YES) |
39 | Correct | 2 ms | 748 KB | OK (n = 90, answer = YES) |
40 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
41 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
42 | Correct | 2 ms | 748 KB | OK (n = 10, answer = YES) |
43 | Correct | 2 ms | 748 KB | OK (n = 100, answer = YES) |
44 | Incorrect | 2 ms | 748 KB | sum of weights should be in [990..1000] but it is 1004 |
45 | Halted | 0 ms | 0 KB | - |