제출 #229809

#제출 시각아이디문제언어결과실행 시간메모리
229809TehillahDetecting Molecules (IOI16_molecules)C++14
0 / 100
5 ms384 KiB
#include "molecules.h" #include <map> #include <set> #include <iostream> using namespace std; #define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i) std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n = w.size(); multiset<int> st; map<int, vector<int>> pos; REP(i, 0, n) { st.insert(w[i]); pos[w[i]].push_back(i); } int le = l; vector<int> v; while(!st.empty()) { auto it = st.lower_bound(l); if(it == st.end()) --it; l -= *it; // assert(!pos[*it].empty()); v.push_back(pos[*it].back()); pos[*it].pop_back(); st.erase(it); if(l <= 0) break; } int tot = 0; for(int x: v) { tot += w[x]; } if(tot < le || tot > u) { v.clear(); v.push_back(-1); } 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...