# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1191694 | simona1230 | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 324 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
int p[500001];
int n;
std::vector<int> find_subset(int l, int u, std::vector<int> w)
{
n=w.size();
p[0]=w[0];
for(int i=1; i<n; i++)
p[i]=p[i-1]+w[i];
for(int l=1; l<=n; l++)
{
int s1=p[l-1];
int s2=p[n-1]-p[n-l]+w[n-l];
if(s1<l&&s2>u||s1>=l&&s1<=u||s2>=l&&s2<=u)
{
for(int i=0; i<n; i++)
{
int j=i+l-1;
int s=p[j]-p[i]+w[i];
if(s>=l&&s<=u)
{
vector<int> ans;
for(int x=i; x<=j; x++)
ans.push_back(x);
return ans;
}
}
}
}
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... |