Submission #715591

#TimeUsernameProblemLanguageResultExecution timeMemory
715591ovidiush11Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define ll long long std::vector<int> find_subset(int l, int u, std::vector<int> w) { ll n = w.size(); sort(w.begin(),w.end()); vector<int> result; while(n != 0 && w[n-1] + w[n-2] < l) { result.push_back(w[n-1]); l -= w[n-1];u -= w[n-1]; n--; } ll left = 0,right = n-1; while(left != right) { if(w[left] + w[right] > u)right--; else if(w[left] + w[right] < l)left++; else break; } if(left == right)while(left != n && w[left] < l){left++;right++;} if(left == right && (w[left] < l || w[left] > u))return {0}; result.push_back(w[left]); if(left != right)result.push_back(w[right]); return result; }
#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...