# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370455 | amano_hina | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
long long n=w.size();
sort(w.begin(),w.end());
vector<int> ans;
long long mn=0,mx=0,cnt;
bool d=1;
for(long long i=0;i<n;i++)
{
mn=mn+w[i];
mx=mx+w[n-1-i];
if(mn>=l&&mn<=u)
{
for(long long j=0;j<=i;j++)
{
ans.push_back(j);
}
break;
}
else if(mx>=l&&mx<=u)
{
for(long long j=n-1;j>=n-1-i;j--)
{
ans.push_back(j);
}
break;
}
else if(mn<l&&u<mx)
{
cnt=mn;
for(long long j=i;j>=0;j--)
{
cnt=cnt-w[j]+w[n-1-(i-j)];
if(cnt>=l&&cnt<=u)
{
for(long long k=0;k<j;k++)
{
ans.push_back(k);
}
for(long long k=n-1;k>=n-1-(i-j);k--)
{
ans.push_back(k);
}
break;
}
}
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... |