# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1235878 | clemmy14 | Detecting Molecules (IOI16_molecules) | C++20 | 35 ms | 4132 KiB |
#include<bits/stdc++.h>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector<pair<int, int>> ww;
for(int i=0; i<n; i++) ww.push_back({w[i], i});
sort(ww.begin(), ww.end());
int s=0, e=0;
long long cur=0;
vector<int> ans;
while(s != n) {
cur += ww[e].first; e++;
while(cur > u) {
cur-=ww[s].first; s++;
}
if(cur >= l && cur <= u) {
for(int i=s; i<e; i++) ans.push_back(ww[i].second);
break;
}
if(e == n) break;
}
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... |