| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 781450 | mindiyak | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 292 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 <algorithm>
#include <vector>
// #include <iostream>
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<ll,ll>> arr;
for(ll i=0;i<w.size();i++){
arr.pb(mp(w[i],i));
}
sort(arr.begin(),arr.end());
ll sum = 0;
vector<int> answer;
for(ll i=0;i<w.size();i++){
if(l<= sum and sum <= u){
break;
}
answer.pb(arr[i].second);
sum += arr[i].first;
// cout << arr[i].first << " " << sum << endl;
if(sum > u){
sum -= arr[answer[0]].first;
// cout << "remove " << answer[0] << " by " << arr[answer[0]].first << " to " << sum << endl;
answer.erase(answer.begin());
}
}
if(l<= sum and sum <= u){
return answer;
}
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... | ||||
