Submission #1062086

#TimeUsernameProblemLanguageResultExecution timeMemory
1062086Hectorungo_18Detecting Molecules (IOI16_molecules)C++14
69 / 100
51 ms6672 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 = n-1; i >= 0; i--){ if(v[i].first > r) continue; 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...