제출 #719949

#제출 시각아이디문제언어결과실행 시간메모리
719949vinnipuh01Detecting Molecules (IOI16_molecules)C++17
0 / 100
1069 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...