Submission #677543

#TimeUsernameProblemLanguageResultExecution timeMemory
677543hello_there_123Detecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms244 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l,int u,vector<int> w){ sort(w.begin(),w.end()); int n = w.size(); vector<int>ans; vector<int>cur; queue<pair<int,int> >q; for(int i=1;i<=n;i++){ while(!q.empty()) q.pop(); cur.clear(); int sum = 0; for(int j=i-1;j>=0;j--){ sum+=w[n-j-1]; q.push(make_pair(w[n-j-1],n-j-1)); } if(sum<l) continue; for(int j=0;j<i;j++){ if(sum<=u && sum>=l){ while(!q.empty()){ ans.push_back(q.front().second); q.pop(); } return ans; } else{ sum-=q.front().first; q.pop(); sum+=w[j]; assert(sum>=l); q.push(make_pair(w[j],j)); } } } 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...