#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l,int u,vector<int> w){
vector<int> ans;
int n=w.size();
vector<pair<int,int>> wp;
for(int i=0;i<n;i++)
wp.push_back({w[i],i});
sort(wp.begin(),wp.end());
int sum=0,check=0;
deque<pair<int,int>> sub;
for(int i=0;i<n;i++){
sum+=w[i],sub.push_back(wp[i]);
while(sum>u) sum-=sub.front().second,sub.pop_front();
if(sum<=u && sum>=l) {check=1;break;}
}
if(!check) return ans;
for(auto i:sub) ans.push_back(i.second);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Runtime error |
3 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |