# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282559 | BeanZ | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define ll long long
#define endl '\n'
const int N = 10005;
const int mod = 1e9 + 7;
vector<ll> find_subset(ll l, ll u, vector<ll> w){
vector<ll> res;
vector<pair<ll, ll>> a;
for (int i = 0; i < w.size(); i++){
a.push_back({w[i], i});
}
sort(a.begin(), a.end());
ll l = 0, sum = 0;
for (int i = 0; i < w.size(); i++){
sum = sum + a[i].first;
while (sum > u){
sum -= a[l].first;
l++;
}
if (sum >= l){
for (int j = l; j <= i; j++){
res.push_back(a[j].second);
}
return res;
}
}
}
/*
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
if (fopen("VietCT.INP", "r")){
freopen("VietCT.INP", "r", stdin);
freopen("VietCT.OUT", "w", stdout);
}
}
*/