# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815251 | TheSahib | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 304 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;
vector<int> find_subset(int v, int u, vector<int> w) {
long long sum = 0;
vector<pair<int, int>> arr;
for (int i = 0; i < w.size(); i++)
{
arr.push_back({w[i], i});
}
sort(arr.begin(), arr.end());
int l = 0, r = 0;
while(l <= r){
if(sum > u){
sum -= w[l];
l++;
}
else if(sum < v){
if(r == w.size()){
return {};
}
sum += w[r];
r++;
}
else{
break;
}
if(l > r){
return {};
}
}
vector<int> ans;
for(int i = l; i < r; ++i){
ans.push_back(arr[i].second);
}
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... |