#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
int sum = w[0];
int r = 0;
vector<pair<int,int>> a(n);
for (int i = 0; i < n; i++) a[i] = {w[i], i};
sort(a.begin(), a.end());
for (int i = 0; i < n; i++) {
r = max(r, i);
if (i == r) sum = a[i].first;
while (r+1 < n && sum + a[r+1].first <= u) {
r++;
sum += a[r].first;
}
if (sum >= l && sum <= u) {
vector<int> ans;
for (int j = l; j <= r; j++) {
ans.push_back(a[j].second);
}
return ans;
}
sum -= a[i].first;
}
return vector<int>();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |