# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170021 | whttt | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 376 KiB |
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 <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
vector<ll> find_subset(int l, int u, vector<int> w){
ll sum = 0;
vector<ll> returnThis;
sort(w.begin(), w.end());
for(ll i = 0;i < w.size();i++){
sum += w[i];
if(sum <= u && sum >= l){
for(ll j = 0;j <= i;j++){
returnThis.push_back(w[i]);
}
return returnThis;
} else if(sum > l){
sum -= w[i];
for(ll j = i;j < w.size();j++){
sum += w[j]-w[j-i];
if(sum <= u && sum >= l){
for(ll j = 0;j <= i;j++){
returnThis.push_back(w[i]);
}
return returnThis;
}
if(j == w.size()-1){
return {};
}
}
}
}
return {};
}
Compilation message (stderr)
# | 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... |