# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1163107 | boclobanchat | Detecting Molecules (IOI16_molecules) | C++20 | 1 ms | 328 KiB |
#include"molecules.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l,int u,vector<int> w)
{
if(w.size()==1)
{
vector<int> ans;
if(w[0]>=l&&w[0]<=u) ans.push_back(0);
return ans;
}
vector<int> ans;
vector<long long> pref;
pref.push_back(0);
int n=w.size();
long long sum=0;
for(int i=0;i<n;i++)
{
pref.push_back(sum+=w[i]);
int pos=upper_bound(pref.begin(),pref.end(),sum-l)-pref.begin()-1;
if(pos<0) continue;
if(sum-pref[pos]<=u)
{
for(int j=pos+1;j<=i+1;j++) ans.push_back(j-1);
return ans;
}
}
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... |