# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74652 | kjain_1810 | Detecting Molecules (IOI16_molecules) | C++17 | 2 ms | 576 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>
#define pb push_back
#define f first
#define s second
using namespace std;
typedef long long ll;
vector< pair<ll, ll> >vec;
ll u, l;
std::vector<int> find_subset(int L, int U, std::vector<int> w) {
for(ll a=0; a<w.size(); a++)
vec.pb({w[a], a});
sort(vec.begin(), vec.end());
ll ptr=0, sum=vec[0].f, u=U, l=L, ptr2=1;
bool flag=false;
for(ll a=1; a<vec.size(); a++)
{
if(sum<=u && sum>=l)
{
flag=true;
ptr2=a;
break;
}
sum+=vec[a].f;
if(sum<=u && sum>=l)
{
flag=true;
ptr2=a+1;
break;
}
while(sum>u)
{
sum-=vec[ptr].f;
ptr++;
}
}
if(!flag)
{
vector<int>yo;
yo.clear();
return yo;
}
vector<int>yo;
for(ll b=ptr; b<ptr2; b++)
{
yo.pb(w[vec[b].s]);
}
return yo;
}
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... |