# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774635 | Sandarach151 | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 212 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;
vector<int> find_subset(int l, int u, vector<int> w) {
sort(w.begin(), w.end());
int pos1 = 0;
int pos2 = 0;
long long cursum = w[0];
vector<int> ans;
bool res = true;
while(true){
if(cursum<l){
pos2++;
if(pos2<w.size()){
cursum+=w[pos2];
}
else{
res = false;
break;
}
}
else if(cursum>u){
cursum-=w[pos1];
pos1++;
if(pos1>pos2){
res = false;
break;
}
}
else{
break;
}
}
if(res==false){
return ans;
}
else{
for(int i=pos1; i<=pos2; i++){
ans.push_back(w[i]);
}
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... |