| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354598 | lizi14 | Detecting Molecules (IOI16_molecules) | C++20 | 27 ms | 3752 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>>x(n);
for(int i=0; i<n; i++){
x[i].first=w[i];
x[i].second=i;
}
sort(x.begin(),x.end());
vector<int>ans;
long long sum=0;
int j=0;
for(int i=0; i<n; i++){
sum+=x[i].first;
if(sum<=u && sum>=l){
for(int h=j; h<=i; h++){
ans.push_back(x[h].second);
}
return ans;
}
if(sum>u){
while(j<n && sum>u){
sum-=x[j].first;
j++;
}
if(sum>=l && sum<=u){
for(int h=j; h<=i; h++){
ans.push_back(x[h].second);
}
return ans;
}
}
}
return ans;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
