Submission #919646

#TimeUsernameProblemLanguageResultExecution timeMemory
919646NurislamDetecting Molecules (IOI16_molecules)C++14
100 / 100
38 ms6548 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> temp) { vector<int> ans; int n=temp.size(); vector<pair<int, int>> w; for (int i = 0; i < n; ++i) { w.push_back({temp[i], i}); } sort(w.begin(), w.end()); long long sum=0; int beg=0; for (int i=0; i<n; i++) { sum+=w[i].first; while (sum>r) sum-=w[beg++].first; if (sum>=l) { for (int j=beg; j<=i; j++) ans.push_back(w[j].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...