# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
320982 | neki | Detecting Molecules (IOI16_molecules) | C++14 | 70 ms | 8784 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>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 1010
#define pa pair<ll, ll>
#define ld long double
vc<int> find_subset(int l, int u, vc<int> w){
vc<pa> ar;
loop(i, 0, w.size()) ar.ps(make_pair(w[i], i));
sort(all(ar));
ll n=ar.size();
vc<ll> sum(n+1, 0);
loop(i, 0, n) sum[i+1]=sum[i]+ar[i].fi;
loop(i, 1, n+1) if(sum[i]-sum[0]<=u and l<=sum[n]-sum[n-i]){
loop(j, 0, n-i+1) if(l<=sum[j+i]-sum[j] and sum[j+i]-sum[j]<=u){
vc<int> ans;
loop(z, j, j+i) ans.ps(ar[z].se);
sort(all(ans));
return ans;
}
}
return vc<int> {};
}
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... |