This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "molecules.h"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> find_subset(int L, int u, vector<int> k) {
int n = (int)k.size();
vector<pair<int,int>>w(n);
for (int i = 0; i < n; i++){
w[i] = {k[i], i};
}
sort(w.begin(),w.end());
for (int i = 0; i < 1; i++){
//shuffle(w.begin(),w.end(),rng);
int l = 0, r = 0;
long long s = 0;
while(r < n){
s += w[r].first;
while(s > u){
s -= w[l].first;
++l;
}
if (s >= L && s <= u){
vector<int>ans;
while(l<=r){
ans.push_back(w[l].second);
++l;
}
return ans;
}
++r;
}
}
return std::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... |