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