Submission #1062083

#TimeUsernameProblemLanguageResultExecution timeMemory
1062083Hectorungo_18Detecting Molecules (IOI16_molecules)C++14
10 / 100
1 ms348 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--){ 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(); } 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...