#include<bits/stdc++.h>
using namespace std;
long long sum ;
int x , n ;
vector < pair < int , int > > vec ;
vector < int > ans ;
vector<int> find_subset ( int l , int u , vector < int > w ) {
n = w . size ( ) ;
for ( int i = 0 ; i < n ; i ++ ) {
vec . push_back ( { w [ i ] , i } ) ;
}
sort ( vec . begin ( ) , vec . end ( ) ) ;
x = 0 ;
for ( int i = 0 ; i < n ; i ++ ) {
while ( x < n && sum < l ) {
sum += vec [ x ] . first ;
x ++ ;
}
if ( sum >= l && sum <= u ) {
for ( int j = i ; j <= x ; j ++ ) {
ans . push_back ( vec [ j ] . second ) ;
}
return ans ;
}
sum -= vec [ i ] . first ;
}
return ans ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
sum of weights should be in [302..304] but it is 353 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
0 ms |
256 KB |
Integer 2 violates the range [0, 1] |
4 |
Halted |
0 ms |
0 KB |
- |