| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 102035 | joylintp | Detecting Molecules (IOI16_molecules) | C++17 | 85 ms | 7160 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;
 
pair<long long, int> ms[200000] = {};
 
vector<int> find_subset(int l, int u, vector<int> w)
{
    int amount = w.size(), i;
    for (i = 0; i < w.size(); i++)
        ms[i].second = i, ms[i].first = (long long)w[i];
    sort(ms, ms + amount);
 
    long long now = 0;
    vector<int> ans;
    i = 0;
    while (now < l && i < amount)
        now += ms[i++].first;
    if (now < l)
        return ans;
    else if (now <= u)
    {
        for (int j = 0; j < i; j++)
            ans.push_back(ms[j].second);
        return ans;
    }
    else
    {
        int lans = 0, rans = i - 2;
        now -= ms[i - 1].first;
        if (now == 0)
            if (ms[0].first > u)
                return ans;
            else
            {
                ans.push_back(ms[0].second);
                return ans;
            }
        while (rans + 1 < amount && now < l)
            now = now - ms[lans].first + ms[rans + 1].first, rans++, lans++;
        if (now > u || now < l)
            return ans;
        else
        {
            for (int i = lans; i <= rans; i++)
                ans.push_back(ms[i].second);
            return ans;
        }
    }
}
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... | ||||
