#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5+5;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef pair<int,pii>piii;
#define sf scanf
#define pf printf
#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)
#define inf 1e16
#define ff first
#define ss second
#define MP make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define printcase(cases) printf("Case %d:", cases);
#define Unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define FAST ios_base::sync_with_stdio(0);cout.tie(0)
//#define endl printf("\n")
#define __lcm(a, b) ((a*b)/__gcd(a, b))
vector<int> find_subset(int l, int u, vector<int> w)
{
int ok = true;
int n = w.size();
int cnt = -1;
vector<pii>arr;
for(int i = 0; i < n; i++) arr.push_back({w[i], i});
sort(all(arr));
ll pre[n+10];
pre[0] = arr[0].ff;
for(int i = 1; i < n; i++) pre[i] = pre[i-1]+arr[i-1].ff;
vector<int>res;
for(int i = 0; i < n; i++)
{
for(int r = i; r < n; r++)
{
ll sum = 0;
if(i==0) sum = pre[r];
else sum = pre[r]-pre[i-1];
if(sum>=l && sum<=u)
{
for(int j = i; j <= r; j++) res.push_back(arr[j].ss);
return res;
}
}
}
return res;
}
Compilation message
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:34:9: warning: unused variable 'ok' [-Wunused-variable]
34 | int ok = true;
| ^~
molecules.cpp:36:9: warning: unused variable 'cnt' [-Wunused-variable]
36 | int cnt = -1;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
6 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |