이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <algorithm>
#define ff first
#define ss second
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
using ll = long long;
using namespace std;
const int N = 200005;
pair<ll, int> we[N];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = w.size();
REP(i, 1, n+1) {
we[i].ff = w[i-1];
we[i].ss = i;
}
vector<int> ret;
sort(we+1, we+n+1);
REP(i, 1, n+1) we[i].ff += we[i-1].ff;
int ri = 1, le = 1;
while(ri <= n) {
while(ri <= n && we[ri].ff - we[le-1].ff < l) ++ri;
while(le <= ri && ri <= n && we[ri].ff - we[le-1].ff > u) ++le;
if(le <= ri && ri <= n && we[ri].ff - we[le-1].ff >= l && we[ri].ff - we[le-1].ff <= u) {
REP(i, le, ri+1)
ret.push_back(we[i].ss-1);
return ret;
}
}
ret.push_back(-1);
return ret;
}
| # | 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... |