# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1244377 | SpyrosAliv | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 328 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MN = 1e4+5;
const int MV = 1e4+5;
int dp[MV];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = w.size();
vector<pair<ll, int>> vals;
for (int i = 0; i < n; i++) vals.push_back({w[i], i});
sort(vals.begin(), vals.end());
ll tot = 0;
vector<int> ans;
for (int i = n-1; i >= 0; i--) {
if (tot + vals[i].first > u) continue;
tot += vals[i].first;
ans.push_back(vals[i].second);
if (tot >= l && tot <= u) return ans;
}
return {};
}
Compilation message (stderr)
# | 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... |