This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
set <int> st, s;
int sum = 0;
for ( auto i : w ) {
if ( sum + i <= l )
st.insert( i ), sum += i;
else
s.insert( i );
}
while ( s.size() && sum < l ) {
sum += *s.rbegin() - *st.begin();
st.erase( st.begin() );
st.insert( *s.rbegin() );
s.erase( --s.end() );
}
vector <int> v;
v.clear();
if ( sum < l )
return v;
for ( auto i : st )
v.push_back( i );
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |