# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243704 | Kubin | Detecting Molecules (IOI16_molecules) | C++17 | 5 ms | 436 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>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w)
{
const size_t n = w.size();
auto v = w;
sort(w.begin(), w.end());
int a = w[0];
for(auto& x : w)
x -= a;
vector<int64_t> s(n + 1), z(n + 1);
for(size_t i = 0; i < n; i++)
s[i+1] = s[i] + w[i], z[i+1] = z[i] + w[n-i-1];
vector<int> result;
for(size_t k = 1; result.empty() and k <= n; k++)
{
for(size_t i = 0; i <= k; i++)
{
auto c = (int64_t)k * a + s[i] + z[k-i];
if(l <= c and c <= u)
{
result.reserve(k);
copy(w.begin(), w.begin() + i, back_inserter(result));
copy(w.end() - (k-i), w.end(), back_inserter(result));
break;
# | 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... |