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 <iostream>
#include <vector>
#include <map>
#include <deque>
#include <algorithm>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int pos=1;
map<int, deque<int>>mp;
for(auto x:w){
mp[x].push_back(pos++);
}
sort(w.begin(), w.end());
int n=w.size();
int a, b, cc;
vector<int>result;
a=b=cc=0;
while(1){
if(b>=n || a>=n) break;
if(cc<l){
if(a>=n) break;
cc+=w[a++]; continue;
}
if(cc>u){
if(b>=n) break;
cc-=w[b++]; continue;
}
for(int i=b; i<a ; i++){
result.push_back(mp[w[i]][0]);
mp[w[i]].pop_front();
}
return result;
}
return std::vector<int>(0);
}
# | 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... |