# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1205579 | ziewacz | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define imie(x...) cerr << "[" #x "]: ", [](auto... $) {((cerr << $ << "; "), ...); }(x), cerr << '\n'
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const int mod=1e9+7;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<int> find_subset(int l, int u, 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());
int le = 0, r = 1;
ll S = v[0].first;
while(le < n && r < n) {
imie(S);
if(S < l) {
S += v[r++].first;
} else if(S > u) {
S -= v[le++].first;
}
else {
vector<int> ans;
for(int i = le; i < r; i++) {
ans.push_back(v[i].second);
}
return ans;
}
}
return {};
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
return 0;
}