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"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 222222
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 1e17+7;
const ll MOD = 998244353;
ll gcd(ll a, ll b){
if(a%b) return gcd(b, a%b);
return b;
}
ll t,n,m;
pi a[MEM];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> ret;
n = w.sz;
for(int i=0; i<n; i++){
a[i].x = w[i];
a[i].y = i;
}
sort(a,a+n);
ll o=0;
ll k;
for(k=n-1; k>=0 && o<l; k--)
o += a[k].x;
k = n-k+1;
ll q,oo=0;
for(q=n-k-1; q>=0; q--){
if(l<=o && o<=u) {
oo = 1;
break;
}
o -= a[q+k].x;
if(q>0)o += a[q-1].x;
}
if(!oo) return ret;
for(ll i=0; i<=k; i++) ret.pb(a[i+q].y);
return ret;
}
# | 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... |