Submission #739556

#TimeUsernameProblemLanguageResultExecution timeMemory
739556Abrar_Al_SamitDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms240 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n = w.size(); vector<int>id(n); iota(id.begin(), id.end(), 0); sort(id.begin(), id.end(), [&] (int i, int j) { return w[i] < w[j]; }); if(w[id[0]]>u) return vector<int>(0); vector<int>ret; long long cur = 0; int j = -1; for(int i=0; i<n; ++i) { ret.push_back(id[i]); cur += w[id[i]]; if(cur>=l) { if(cur>u) { j = i; break; } else { return ret; } } } if(j==-1) return vector<int>(0); cur -= w[ret[0]]; //assert(cur >= l && cur <= u); ret.erase(ret.begin()); return ret; }
#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...