Submission #211452

#TimeUsernameProblemLanguageResultExecution timeMemory
211452anonymousDetecting Molecules (IOI16_molecules)C++14
100 / 100
69 ms6252 KiB
#include "molecules.h" #include <algorithm> #include <utility> #define LL long long std::vector<int> find_subset(int l, int u, std::vector<int> w) { int N = w.size(), k = 0; LL sL = 0, sR = 0; std::vector<std::pair<int,int> > W; std::vector<int> ans; for (int i=0; i<N; i++) { W.push_back({w[i],i}); } std::sort(W.begin(), W.end()); while (k < N) { sR += W[N - 1 - k].first, sL += W[k].first; k++; if (sR < l || sL > u) {continue;} else { int left = 0; while (sL < l) { sL += W[left+k].first - W[left].first; left++; } for (int i=left; i<left+k; i++) { ans.push_back(W[i].second); } return(ans); } } return(ans); }
#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...