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"
using namespace std;
long long o,n,b,c,p[200005],e,l,r,md,jog,k;
vector<int> a,d;
pair <int, int> u[200005];
vector<int> find_subset(int x, int y, vector<int> v){
n = v.size();
for (int i = 0; i < v.size(); i++) u[i].first = v[i], u[i].second = i;
sort(u, u + n);
p[0] = u[0].first;
for (int i = 1; i < n; i++) p[i] = p[i - 1] + u[i].first;
for (int i = 0; i < n; i++){
a.push_back(u[i].second);
if (x <= p[i] and p[i] <= y){
sort(a.begin(), a.end());
return a;
}
}
a.clear();
for (int i = 1; i < n; i++){
l = i, r = n - 1, jog = -1;
while (l <= r){
md = (l + r) / 2;
if (y < p[md] - p[i - 1]) r = md - 1;
else if (x > p[md] - p[i - 1]) l = md + 1;
else{
e = i; jog = md;
break;
}
}
if (jog != -1) break;
}
for (int i = e; i <= jog; i++) a.push_back(u[i].second);
sort(a.begin(), a.end());
return a;
}
Compilation message (stderr)
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
8 | for (int i = 0; i < v.size(); i++) u[i].first = v[i], u[i].second = i;
| ~~^~~~~~~~~~
# | 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... |