Submission #799615

#TimeUsernameProblemLanguageResultExecution timeMemory
799615kirakaminski968Detecting Molecules (IOI16_molecules)C++17
100 / 100
39 ms6032 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>> info; int n = w.size(); for(int i = 0;i<n;++i){ info.push_back({w[i],i}); } sort(info.begin(),info.end()); int j = -1; long long cursum = 0; for(int i = 0;i<n;++i){ while(j+1 < n && cursum < l){ j++; cursum += info[j].first; } if(l <= cursum && cursum <= u){ vector<int> ans; for(int k = i;k<=j;++k) ans.push_back(info[k].second); return ans; } cursum -= info[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...