# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
32034 | osmanorhan | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 5144 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 fi first
#define se second
#define all( x ) x.begin(), x.end()
#define umin( x, y ) x = min( x, (y) )
#define umax( x, y ) x = max( x, (y) )
#define pb push_back
using namespace std;
typedef long long Lint;
typedef pair<int,int> ii;
const int inf = 1e9 + 137;
const int maxn = 200020;
Lint pre[maxn];
Lint suf[maxn];
vector<int> find_subset(int l, int u, vector<int> w) {
sort( all( w ) );
vector<int> ans;
for(int i=0;i<w.size();i++) {
if( i == 0 ) pre[i] = w[i];
else pre[i] = w[i] + pre[i-1];
}
for(int i=w.size()-1;i>=0;i--) {
if( i == w.size()-1 ) suf[i] = w[i];
else suf[i] = w[i] + suf[i+1];
}
for(int i=0;i<w.size();i++)
if( !( u < pre[i] || suf[w.size()-i-1] < l ) ) {
Lint tot = 0;
for(int j=0;j<i;j++) ans.pb( j ), tot += w[j];
for(int j=i-1,last=w.size()-1;j>=0;j--,last--) {
if( tot >= l ) break;
tot += w[last] - w[j];
ans[j] = w[last];
}
return ans;
}
return ans;
}
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... |