# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959277 | hyakup | Detecting Molecules (IOI16_molecules) | C++17 | 4 ms | 1116 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>
#include "molecules.h"
using namespace std;
vector<int> find_subset(int l, int r, vector<int> w ){
vector<pair<int, int>> v( w.size() );
for( int i = 0; i < w.size(); i++ ) v[i] = make_pair(w[i], i);
sort( v.begin(), v.end());
vector<int> sv(w.size() + 1), resp;
set<pair<int, int>> s; s.insert({0, 0});
for( int i = 1; i <= sv.size(); i++ ){
sv[i] = sv[i - 1] + v[i - 1].first;
s.insert({ sv[i], i });
auto it = s.lower_bound({ sv[i] - r, -1});
if( it->first <= sv[i] - l ){
for( int j = it->second; j < i; j++ ) resp.push_back(v[j].second);
break;
}
}
return resp;
}
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... |