| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360056 | skuru | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 344 KiB |
#include "molecules.h"
#include <algorithm>
#include <iostream>
using namespace std;
#define all(v) (v).begin(), (v).end()
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
int minw = *min_element(all(w));
int a = 0, b = 0;
for (int i = 0; i < n; i++) {
if (w[i] == minw)
a++;
else
b++;
}
for (int x = 0; x <= a; x++) {
for (int y = 0; y <= b; y++) {
int sum = x*minw + y*(minw + 1);
if (l <= sum and sum <= u) {
vector<int> ret;
for (int i = 0; i < n and (x > 0 or y > 0); i++) {
if (x > 0 and w[i] == minw) {
x--;
ret.push_back(i);
} else if (y > 0 and w[i] == minw + 1) {
y--;
ret.push_back(i);
}
}
return ret;
}
}
}
return {};
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
