#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define pop_front(v) v.erase(v.begin())
#define REP(i, a, b) for (int i=a; i<=b; i++)
#define REPn(i, a, b) for (int i=a; i>=b; i--)
#define FOR(i, n) REP(i, 0, n-1)
#define FORn(j, n) REPn(j, n-1, 0)
#define all(v) (v).begin(), (v).end()
#define allR(v) (v).rbegin(), (v).rend()
vi solve(int l, int r, vi w, int i) {
vi aa = {};
if (i==0) return aa;
if (w[i]<=r) {
aa.PB(i);
if (w[i]>=l) return aa;
vi ab = solve(l-w[i],r-w[i],w,i-1);
for (int a: ab) aa.PB(a);
return aa;
} else return solve(l,r,w,i-1);
}
vi find_subset(int l, int u, vi w) {
sort(all(w));
vi aa = solve(l,u,w,w.size()-1);
int sum=0;
for (int a: aa) sum+=w[a];
if (sum>=l) return aa;
else return {};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
364 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
364 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
364 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
364 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
364 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
364 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
364 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
364 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
364 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
364 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |