# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
715687 | ovidiush11 | Detecting Molecules (IOI16_molecules) | C++14 | 49 ms | 6968 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 <bits/stdc++.h>
using namespace std;
#define ll long long
std::vector<int> find_subset(int p, int u, std::vector<int> a)
{
vector<pair<ll,ll>> w(a.size());
for(ll i = 0;i < a.size();i++)w[i] = {a[i],i};
sort(w.begin(),w.end());
ll l = 0,r = 0,s = 0;
while(r < a.size())
{
s += w[r].first;
while(s > u)
{
s -= w[l].first;
l++;
}
if(s >= p && s <= u)
{
vector<int> ans;
for(ll i = l;i <= r;i++)ans.push_back(w[i].second);
return ans;
}
r++;
}
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... |