Submission #554355

#TimeUsernameProblemLanguageResultExecution timeMemory
554355n0sk1llDetecting Molecules (IOI16_molecules)C++14
100 / 100
49 ms6212 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; long long int typedef li; vector<int> find_subset(int l, int u, vector<int> w) { int n=w.size(); vector<int> ans; li tsum=0; vector<pair<int,int>> pom; for (int i=0;i<n;i++) pom.push_back({w[i],i}); sort(pom.begin(),pom.end()); int p=0,q=-1; while (true) { if (q==n-1) break; tsum+=pom[++q].first; while (tsum>u) tsum-=pom[p++].first; if (l<=tsum && tsum<=u) { for (int i=p;i<=q;i++) ans.push_back(pom[i].second); break; } } sort(ans.begin(),ans.end()); 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...