# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
262441 | themax23 | Detecting Molecules (IOI16_molecules) | C++17 | 62 ms | 8396 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;
typedef long long ll;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = (int) w.size();
vector<pair<ll,ll>> v;
for(ll i = 0; i < n; ++i){
pair<ll,ll> p = {w[i],i};
v.push_back(p);
}
sort(v.begin(), v.end());
ll i = 0, j = 0, sum = 0, ans = 0;
while(i < n){
while(sum < l && j < n)
{sum += v[j].first; ++j;}
if(sum >= l && sum <= u){ans = sum; break;}
sum -= v[i].first; ++i;
}
//cerr << ans;
vector<int> sub;
while(i < j)
{sub.push_back(v[i].second); ++i;}
return sub;
}
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... |