#include <bits/stdc++.h>
#include "molecules.h"
#define f first
#define s second
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size(); vector<pair<int,int>> p(n);
for(int i=0;i<n;i++) p[i].f = w[i], p[i].s = i+1;
sort(begin(p),end(p));
int x = 0, y = 0, c = p[0].f;
while(y < n) {
while(c > u) c -= p[x].f, x++;
if(c >= l) break;
y++; if(y < n) c += p[y].f;
}
vector<int> v;
if(y == n) return v;
else {for(int i=x;i<=y;i++) v.push_back(p[i].s); return v;}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
5 |
Incorrect |
0 ms |
348 KB |
sum of weights should be in [290..300] but it is 301 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
348 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |