# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1245165 | warrenn | Detecting Molecules (IOI16_molecules) | C++20 | 37 ms | 4128 KiB |
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int,int> >cek;
for(int q=0;q<w.size();q++){
cek.push_back({w[q],q});
}
sort(cek.begin(),cek.end());
long long le=0;
long long ri=0;
long long tot=0;
while(le<w.size()){
while(ri<w.size() && tot<l){
tot+=cek[ri].first;
ri++;
}
if(tot>=l && tot<=u){
vector<int>ans;
for(int q=le;q<ri;q++){
ans.push_back(cek[q].second);
}
return ans;
}
tot-=cek[le].first;
le++;
}
if(tot>=l && tot<=u){
vector<int>ans;
for(int q=le;q<ri;q++){
ans.push_back(cek[q].second);
}
return ans;
}
return vector<int>();
}
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... |