# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875745 | raul2008487 | Detecting Molecules (IOI16_molecules) | C++17 | 43 ms | 65536 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 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;
ll i, j, n = w.size(), left = 0, r = 1, sum = w[0];
sort(all(w));
bool as = 0;
while(r <= n){
if(check(sum, left, u)){
for(i=left+1;i<=r;i++){
ans.pb(i);
as = 1;
break;
}
}
else if(sum > u){
left++;
sum -= w[l-1];
}
else{
r++;
sum += w[r-1];
}
}
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... |