# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875751 | raul2008487 | Detecting Molecules (IOI16_molecules) | C++17 | 1081 ms | 348 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<bits/stdc++.h>
#include "molecules.h"
#define ll int
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define vl vector<ll>
using namespace std;
bool check(ll cur, ll low, ll high){
return (cur <= high && cur >= low);
}
vector<int> find_subset(int l, int u, vector<int> w) {
vl ans;
vector<pair<ll,ll>> p;
ll i, j, n = w.size(), left = 0, r = 1, sum = w[0];
for(i=0;i<n;i++){
p.pb({w[i], i});
}
sort(all(p));
bool as = 0;
while(r <= n){
if(check(sum, l, u)){
for(i=left;i<r;i++){
ans.pb(p[i-1].se);
break;
}
}
else if(sum > u){
left++;
sum -= p[l-1].fi;
}
else{
r++;
sum += p[r-1].fi;
}
}
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... |