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>
#include "molecules.h"
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
/// author: LilPluton auuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
#define OPT ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ll long long
#define arr array
#define vll vector<int>
#define segment_tree int l=n*2,r=l+1,mid=(b+e)/2
#define fi first
#define se second
#define rep(i,j,k) for(int i = j; i <= k; ++i)
#define all(a) a.begin(),a.end()
#define pii pair<ll,int>
#define endll '\n'
using namespace std;
const int N = 1e5 + 5;
vector<int> find_subset(int l, int u, vector<int> w) {
sort(w.begin(), w.end());
int n = w.size();
vector<pii>a(n);
for(int i = 0; i < n; ++i)
a[i] = {w[i], i};
sort(all(a));
ll sum = 0;
int lb = 0, rb = 0;
vector<int>ans;
while(rb <= n)
{
if(sum < l)
{
if(rb < n)
sum += a[rb].first, ++rb;
else
return ans;
}
else if(sum > u)
{
sum -= a[lb].first;
++lb;
}
if(sum >= l && sum <= u)
{
sum = 0;
for(int i = lb; i < rb; i++)
ans.push_back(a[i].second);
return ans;
}
}
return ans;
}
Compilation message (stderr)
molecules.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
5 | #pragma GCC optimization("unroll-loops")
|
# | 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... |