# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172335 | 2020-01-01T09:59:05 Z | mohammad | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 KB |
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒mohammad▒▀██████▄ ░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████ ░▐██▒▒▒alwrawrah▒▒▒▒▒████▌ ░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌ ░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌ ░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌ ░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌ ░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌ ░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█ ░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀ ░░░░▄██████████████▒▒▐▌ ░░░▀███▀▀████▀█████▀▒▌ ░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐ ░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐ */ #include<bits/stdc++.h> #include "molecules.h" using namespace std; typedef long long ll ; const ll oo = 1e13 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; vector<pair<int,int>> v; ll sum = 0 ; vector<int> ans; vector<int> find_subset(int l, int u, vector<int> w) { int idx = 0; for(int i = 0 ; i < w.size() ; ++i) v.push_back({w[i] , i}); sort(v.begin(), v.end()); for(int i = 0 ; i < w.size() ; ++i){ sum += u ; while(sum > u) sum -= v[idx++].first; if(sum >= l){ for(int j = idx ; j <= i ; ++j) ans.push_back(j + 1); return; } } return ans; }