Submission #599170

#TimeUsernameProblemLanguageResultExecution timeMemory
599170JomnoiDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; vector <int> find_subset(int L, int U, vector <int> w) { int n = w.size(); vector <pair <int, int>> weights; for(int i = 0; i < n; i++) { weights.emplace_back(w[i], i); } sort(weights.begin(), weights.end()); long long sum = 0; for(int l = 0, r = 0; l < n; l++) { while(r < n and sum <= U) { sum += weights[r].first; r++; } if(L <= sum and sum <= U) { vector <int> ans; for(int i = l; i < r; i++) { ans.push_back(weights[i].second); } return ans; } sum -= weights[l].first; } return {}; }
#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...