Submission #770740

#TimeUsernameProblemLanguageResultExecution timeMemory
770740kirakaminski968Detecting Molecules (IOI16_molecules)C++17
100 / 100
43 ms5376 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w){ vector<pair<int,int>> vec; int n = w.size(); for(int i = 0;i<n;++i) vec.push_back({w[i],i}); sort(vec.begin(),vec.end()); int r = -1; long long sum = 0; for(int i = 0;i<n;++i){ while(r+1 < n && sum < l){ r++; sum += vec[r].first; } if(l <= sum && sum <= u){ vector<int> ans; for(int j = i;j<=r;++j) ans.push_back(vec[j].second); return ans; } sum -= vec[i].first; } 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...