# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
999332 | vuh | Detecting Molecules (IOI16_molecules) | C++14 | 1067 ms | 348 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 <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define inf INT_MAX
std::vector<int> find_subset(int l, int u, std::vector<int> w){
int n = w.size(),mini = inf,maxi = -inf,x = u - l,sum = 0;
for(int i =0;i<n ;i++){
mini = min(mini,w[i]);
maxi = max(maxi,w[i]);
sum += w[i];
}
vector <int> ans;
if(maxi - mini > x){
return vector <int> (0);
}
while(!next_permutation(w.begin(),w.end())){
for(int i =0;i<n ;i++){
sum = 0;
for(int j =0;j<=i ;j++){
sum += w[j];
}
if((sum >= l && sum <= u) || (sum <= l && sum >= u)){
for(int j =0;j<=i ;j++){
ans.push_back(w[j]);
}
return ans;
}
}
}
}
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... |