# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1263635 | piolk | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l,int r,vector<int> w){
unordered_map<int,int> wyst; // value,index
for (int i=0;i<w.size();i++) wyst[w[i]]=i+1;
sort(w.begin(),w.end());
int n=w.size();
int R=-1;
int L=0;
int sum=0;
while (R<n-1){
R++;
sum+=w[R];
while (sum>r && L<R){
sum-=w[L];
L++;
}
if (sum>=l && sum<=r){
vector<int> indices;
for (int i=L;i<=R;i++) indices.push_back(wyst[w[i]]);
return indices;
}
}
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... |