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 "molecules.h"
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const int N = 2e5 + 10;
const int INF = 1e9 + 10;
vector <int> find_subset(int l, int u, vector <int> w) {
int n = (int)w.size();
vector <pair<int, int>> esim;
for (int i = 0; i < n; i++) {
esim.push_back({ w[i], i });
}
sort(esim.begin(), esim.end());
for (int i = 0; i < n; i++) {
int sm = 0;
vector <int> v;
for (int j = i; j < n; j++) {
sm += esim[j].first;
v.push_back(esim[j].second);
if (sm >= l && sm <= u) {
return v;
}
}
}
return {};
}
/*
int main() {
for (auto it : find_subset(15, 17, { 6, 8, 8, 7 })) {
cout << it << " ";
}
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |