Submission #706768

#TimeUsernameProblemLanguageResultExecution timeMemory
706768Yell0Detecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef long long ll; vector<int> find_subset(int l,int u,vector<int> w) { int n=w.size(); vector<int> ans; vector<pii> a; for(int i=0;i<n;++i) a.push_back({w[i],i}); sort(a.begin(),a.end()); int i=0,j=0; ll sum=0; for(;i<n;++i) { sum+=a[i].first; if(sum>=l) break; } if(sum<l) return ans; for(;j<=i;++j) { sum-=a[j].first; if(sum<=u) break; } if(sum>u) return ans; for(int x=j;x<=i;++x) ans.push_back(a[x].second); 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...