Submission #970725

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