# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397730 | chirathnirodha | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 588 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.
//Coded by Chirath Nirodha
#include<bits/stdc++.h>
#include "molecules.h"
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define P push
#define I insert
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
const ll mod=1e9+7;
inline void io(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
vector<int> find_subset(int l, int u, vector<int> w) {
int n=w.size();
vector<pair<int,int> > v;
for(int i=0;i<n;i++)v.PB(MP(w[i],i));
sort(v.begin(),v.end());
int cur=0;int x,y;x=y=0;
vector<int> ans;
for(y;y<n;y++){
cur+=v[y].F;
if(cur>u){cur-=v[x].F;x++;}
if(l<=cur && cur<=u){
for(int i=x;i<=y;i--)ans.PB(v[i].S);
break;
}
}
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... |