이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair <int, int> pii;
// return value: result if solution exists and empty vector otherwise
vector<int> find_subset( int l, int u, vector<int> w ) {
int n = w.size();
vector<pii> wp(n);
forn(i, n)
wp[i] = {w[i], i};
mt19937 rnd(239);
forn(_, 1000) {
shuffle(wp.begin(), wp.end(), rnd);
int sum = 0, i = 0;
while (i < n && sum < l)
sum += wp[i++].first;
if (l <= sum && sum <= u) {
vector<int> res(i);
forn(j, i)
res[j] = wp[j].second;
return res;
}
}
return vector<int>();
}
| # | 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... |