# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773018 | teokakabadze | Detecting Molecules (IOI16_molecules) | C++17 | 35 ms | 5548 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;
int s, e, sum, i;
std::vector<int> find_subset(int l, int u, std::vector<int> a)
{
vector<int> v;
vector<pair<int, int>> w;
int n = a.size();
for(i = 0; i < n; i++)
w.pb({a[i], i});
sort(w.begin(), w.end());
s = e = 0, sum = w[0].f;
bool f = 1;
while(f)
{
//cout << s << ' ' << e << ' ' << sum << '\n';
if(sum >= l && sum <= u)
{
int ans = 0;
for(i = s; i <= e; i++)
v.pb(w[i].s);
return v;
}
f = 0;
while(e < n - 1 && sum < l)
sum += w[++e].f, f = 1;
while(s < e && sum > u)
sum -= w[s++].f, f = 1;
}
return v;
}
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... |