Submission #849653

#TimeUsernameProblemLanguageResultExecution timeMemory
849653Bach21Detecting Molecules (IOI16_molecules)C++14
69 / 100
36 ms4036 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int,int>> w1; int n=w.size(); for (int i=0;i<n;i++) { w1.push_back({w[i],i}); } int sum=0; vector<int> res; sort(w1.begin(),w1.end()); for (int i=0,j=0;j<n;j++) { sum+=w1[j].first; while (sum>u) { sum-=w1[i++].first; } if (sum>=l) { for (int k=i;k<=j;k++) { res.push_back(w1[k].second); } break; } } return res; }
#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...