Submission #971296

#TimeUsernameProblemLanguageResultExecution timeMemory
971296KasymKDetecting Molecules (IOI16_molecules)C++17
100 / 100
39 ms6348 KiB
#include "bits/stdc++.h" using namespace std; vector<int> find_subset(int l, int u, vector<int> w){ int n = (int)w.size(); vector<pair<int, int>> v; for(int i = 0; i < n; ++i) v.push_back({w[i], i}); sort(v.begin(), v.end()); long long sum = 0; vector<int> answer; for(int i = 0, j = 0; j < n; ++j){ sum += v[j].first; while(sum > u) sum -= v[i++].first; if(sum >= l){ for(int k = i; k <= j; ++k) answer.push_back(v[k].second); return answer; } } return vector<int> {}; }
#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...