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 <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define pi pair < int, int >
const int N = 2e5 + 7;
int n, lf;
ll s;
vi ans, h, pos[N];
map < int, int > mp;
std::vector<int> find_subset(int l, int u, std::vector <int> w) {
    h = w;
    n = w.size();
    sort(h.begin(), h.end());
    for (int i = 0; i < n; i++)
        if (!i || h[i] != h[i - 1])
            mp[h[i]] = i;
    for (int i = 0; i < n; i++)
        pos[mp[w[i]]].pb(i);
    for (int i = 0; i < n; i++){
        s += h[i];
        if (s > u){
            s -= h[lf];
            lf++;
        }
        if (s >= l){
            for (int j = lf; j <= i; j++){
                ans.pb(pos[mp[h[j]]].back());
                pos[mp[h[j]]].pop_back();
            }
            break;
        }
    }
    return ans;
}
| # | 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... |