| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 88353 | amiratou | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 644 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 fi first
#define se second
using namespace std;
vector<int> ans;
vector<pair<int,int> > vec;
void process(int j,int i){
for (int idx = j; idx <= i ; ++idx)
ans.push_back(vec[idx].se);
}
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vec.resize(w.size());
for (int i = 0; i < w.size(); ++i)
{
vec[i].fi=w[i];
vec[i].se=i;
}
sort(vec.begin(),vec.end());
if(vec[0].fi>=l&&vec[0].fi<=u){
process(0,0);
return ans;
}
for (int i = 1; i < w.size(); ++i){
vec[i].fi+=vec[i-1].fi;
if(vec[i].fi>=l&&vec[i].fi<=u){
process(0,i);
return ans;
}
}
for (int i = 0; i < w.size(); ++i)
{
if(vec[i].fi>u){
auto search=lower_bound(vec.begin(),vec.begin()+i,make_pair(vec[i].fi-l,0));
if(search==vec.begin()+i) continue;
if((vec[i].fi-search->fi)>=l&&(vec[i].fi-search->fi)<=u){
process((search-vec.begin())+1,i);
return ans;
}
}
}
return vector<int>(0);
}
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... | ||||
