이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "molecules.h"
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
const int inf = 1e9 + 10000;
const int mod = 1e9+7;
const int maxn = 5e5 + 12;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vi ans;
int s = 0, j = 0;
pair<int, int> p[n];
for(auto i : w) {
if(i >= l && i <= u) {
return {j};
}
p[j] = {i, j};
j++;
}
sort(p, p + n);
j = 0;
if(p[0].ff > u || n == 1)return ans;
if(p[0].ff + p[n - 1].ff > u) {
if(p[0].ff + p[1].ff > u) {
return ans;
}
else {
return {p[0].ss, p[1].ss};
}
}
for(int i = n - 1; i > 0; i--) {
ans.pb(p[i].ss);
s += p[i].ff;
if(s > u)break;
if(s >= l)return ans;
if(s + p[0].ff <= u && s + p[0].ff >= l){
ans.pb(p[0].ss);
return ans;
}
}
return vi(0);
}
# | 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... |