Submission #493662

#TimeUsernameProblemLanguageResultExecution timeMemory
493662IwanttobreakfreeDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms264 KiB
#include "molecules.h" #include <vector> #include <algorithm> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector<pair<int,int> >mol(n); for(int i=0;i<n;i++)mol[i]={w[i],i}; sort(mol.begin(),mol.end()); int ans=0,j=-1; for(int i=0;i<n;i++){ while(j<n&&mol[j].first+ans<=u){ ans+=mol[j].first; j++; } if(ans>=l){ vector<int> sol; for(int k=i;k<j;k++)sol.push_back(mol[i].second); return sol; } } return vector<int>(0); }
#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...