# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132448 | bogdan10bos | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 380 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.
/// 00:00 , should I call ?
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<int> ord;
for(int i = 0; i < w.size(); i++) ord.push_back(i);
sort(ord.begin(), ord.end(),
[&](int a, int b) { return w[a] < w[b]; } );
vector<LL> sum(w.size());
LL s = 0;
for(int i = 0; i < w.size(); i++)
{
s += w[ ord[i] ];
sum[i] = s;
}
vector<int> ans;
for(int i = 0; i < w.size(); i++)
if(l <= sum[i] && sum[i] <= u)
{
for(int j = 0; j <= i; j++) ans.push_back(ord[j]);
sort(ans.begin(), ans.end());
return ans;
}
for(int i = 0; i < w.size(); i++)
if(l <= s - sum[i] && s - sum[i] <= u)
{
for(int j = (int)w.size() - 1; j > i; j--) ans.push_back(ord[j]);
sort(ans.begin(), ans.end());
return ans;
}
if(l <= s && s <= u)
{
sort(ord.begin(), ord.end());
return ord;
}
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... |