이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define x first
#define y second
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w)
{
    vector<pair<ll,int>> pw;
    for(int x:w) pw.pb({(ll)(x),int(pw.size())});
    sort(pw.begin(),pw.end());
    ll sum=0;
    int ptr=0;
    vector<int> ans;
    bool flag=0;
    while(ptr<int(pw.size()))
    {
        if(sum+pw[ptr].x<l) sum+=pw[ptr].x, flag=1;
        else if(sum+pw[ptr].x<=u)
        {
            ans.pb(pw[ptr].y);
            return ans;
        }
        else break;
        ans.pb(pw[ptr].y);
        ptr++;
    }
    if(!flag) return {};
    for(int i=0;i<int(ans.size()) && pw.size()-1-i>=ans.size();i++)
    {
        sum+=pw[pw.size()-1-i].x-pw[i].x;
        ans[i]=pw[pw.size()-1-i].y;
        if(sum>=l) return ans;
    }
    return {};
}
| # | 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... |