# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40036 | igzi | Detecting Molecules (IOI16_molecules) | C++14 | 71 ms | 6868 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 maxN 200002
using namespace std;
struct molekul{
long long x,p;
};
bool poredi(molekul a,molekul b){
return a.x<b.x;
}
vector <int> find_subset(int l,int u,vector <int> w){
long long i,a,b,k;
molekul m[maxN];
vector <int> v;
for(i=0;i<w.size();i++){
m[i].x=w[i];
m[i].p=i;
}
a=b=k=0;
sort(m,m+w.size(),poredi);
while(k<w.size() && b<l){
a+=m[k].x;
b+=m[w.size()-1-k].x;
k++;
}
if(b>=l && a<=u){
int x=k;
while(a<l){
a+=m[x].x-m[x-k].x;
x++;
}
for(i=x-k;i<x;i++){
v.push_back(m[i].p);
}
}
return v;
}
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... |