#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 200
#define mid (l+r)/2
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod=1e9+7;
const ll inf= 4e18;
const ld pai=acos(-1);
#include "molecules.h"
int n;
int a[10009];
int dp[2][10009];
int p[10009];
vi id[10009];
vi path(int x){
vi ret;
while ( p[x]!=x){
ret.pb( id[ x-p[x] ].back() );
id [ x-p[x] ] .pop_back();
x = p[x];
}
return ret;
}
vi find_subset(int l, int u,vi w) {
n = w.size();
for ( int i =0 ;i < n;i ++ ){
id [ w[i] ] .pb (i);
}
dp[0][0]=1;
for(int i =0 ;i < n ;i ++ ){
for(int j = 0 ;j <= 1e4 ;j++){
if ( j-w[i] >=0 && dp[0][ j -w[i] ] ){
dp[1][j] = 1 ;
p [j] = j-w[i];
}
else dp [1][j]=dp[0][j];
}
for ( int j =0 ;j <= 1e4 ;j ++ ) {
dp [0][j] = dp[1][j];
dp [1][j] = 0;
}
}
for ( int i =l ; i<=u ;i++ ){
if ( dp [0][i] ){
return path(i);
}
}
return std::vector<int>(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
6 ms |
632 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
636 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
9 ms |
760 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
8 ms |
632 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
6 ms |
680 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
5 ms |
632 KB |
OK (n = 6, answer = YES) |
10 |
Incorrect |
5 ms |
632 KB |
Integer 49 violates the range [0, 11] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
6 ms |
632 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
636 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
9 ms |
760 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
8 ms |
632 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
6 ms |
680 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
25 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
26 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
27 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
28 |
Correct |
5 ms |
632 KB |
OK (n = 6, answer = YES) |
29 |
Incorrect |
5 ms |
632 KB |
Integer 49 violates the range [0, 11] |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
6 ms |
632 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
636 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
9 ms |
760 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
8 ms |
632 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
6 ms |
680 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
25 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
26 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
27 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
28 |
Correct |
5 ms |
632 KB |
OK (n = 6, answer = YES) |
29 |
Incorrect |
5 ms |
632 KB |
Integer 49 violates the range [0, 11] |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
6 ms |
632 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
636 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
9 ms |
760 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
8 ms |
632 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
6 ms |
680 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
25 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
26 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
27 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
28 |
Correct |
5 ms |
632 KB |
OK (n = 6, answer = YES) |
29 |
Incorrect |
5 ms |
632 KB |
Integer 49 violates the range [0, 11] |
30 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
5 ms |
632 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
5 ms |
632 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
6 ms |
632 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
5 ms |
636 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
5 ms |
632 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
9 ms |
760 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
8 ms |
632 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
6 ms |
680 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
25 |
Correct |
5 ms |
632 KB |
OK (n = 12, answer = YES) |
26 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
27 |
Correct |
7 ms |
632 KB |
OK (n = 12, answer = YES) |
28 |
Correct |
5 ms |
632 KB |
OK (n = 6, answer = YES) |
29 |
Incorrect |
5 ms |
632 KB |
Integer 49 violates the range [0, 11] |
30 |
Halted |
0 ms |
0 KB |
- |