Submission #1062089

#TimeUsernameProblemLanguageResultExecution timeMemory
1062089Hectorungo_18Detecting Molecules (IOI16_molecules)C++14
69 / 100
33 ms5092 KiB
#include <bits/stdc++.h> using namespace std; // #define int long long vector<int> find_subset(int l, int r, vector<int> w){ int n = w.size(); vector<pair<int, int>> v(n); for(int i = 0; i < n; i++){ v[i]={w[i], i}; } sort(v.begin(), v.end()); queue<pair<int, int>> sol; int aux = 0; for(int i = 0; i < n; i++){ if(v[i].first > r) break; while(aux+v[i].first > r){ aux-=sol.front().first; sol.pop(); } aux+=v[i].first; sol.push(v[i]); if(aux >= l) break; } if(aux < l || aux > r){ while(sol.size()) sol.pop(); } vector<int> ans; while(sol.size()){ ans.push_back(sol.front().second); sol.pop(); } // if(ans.size()) reverse(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...