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;
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define el '\n'
#define BIT(mask, i) (((mask) >> (i)) & 1)
#define MASK(i) (1LL << (i))
#define fi first
#define se second
#include <molecules.h>
template <class T1, class T2>
bool minimize(T1 &a, T2 b) {
if(a > b){a = b; return true;} return false;
}
template <class T1, class T2>
bool maximize(T1 &a, T2 b) {
if(a < b) {a = b; return true;} return false;
}
const ll MOD = (ll)1e9 + 7;
template <class T1, class T2>
void add(T1 &a, T2 b) {
a += b;
if(a >= MOD) a -= MOD;
}
const ll INF = (ll)1e18 + 10LL;
const int oo = (int)1e9 + 10;
const int MAX = 555;
const int MAX_EDGE = (int)2e5 + 10;
const int LOG = 20;
vector <int> find_subset(int l, int r, vector <int> a) {
ll cur = 0;
int j = 0;
vector <pair<ll, int> > ord;
for (int i = 0; i < a.size(); i++) {
ord.push_back(make_pair(a[i], i));
}
sort(ord.begin(), ord.end());
for(int i = 0; i < a.size(); i++) {
cur += ord[i].fi;
while(cur > r) {
cur -= ord[j++].fi;
}
if(cur >= l) {
vector <int> ans;
for(int k = j; k <= i; k++) {
ans.push_back(ord[k].se);
}
return ans;
}
}
vector <int> empty;
return empty;
}
Compilation message (stderr)
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:46:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | for (int i = 0; i < a.size(); i++) {
| ~~^~~~~~~~~~
molecules.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for(int i = 0; i < a.size(); 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... |