이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 1e5+5;
#define all(x) x.begin(), x.end()
#define mk make_pair
#define pb push_back
#define f first
#define s second
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size(), t = 0;
ll sum = 0;
vector<ll> prefix(n+1, 0);
vector<pii> v(n);
for(int i = 0; i < n; i++)
v[i] = {w[i], i};
sort(all(w));
sort(all(v));
for(int i = 1; i <= n; i++)
prefix[i] = w[i-1] + prefix[i-1];
for(int i = 0; i < n; i++) {
sum += w[i];
if(sum > u) { t = i; break; }
}
for(int i = 0; i <= n-t; i++) {
if(u >= prefix[i+t] - prefix[i] and prefix[i+t] - prefix[i] >= l) {
vector<int> resp;
for(int j = i; j < i+t; j++) resp.pb(v[j].s);
return resp;
}
}
return vector<int>(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... |