#include<bits/stdc++.h>
#include "molecules.h"
#define ll long long
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;
vector<int> find_subset(int l, int u, vector<int> w)
{
vector<int> ans;
set<pii, greater<pii>> _Max, Max;
set<pii> Min, _Min;
int n; ll s = 0;
pii top;
n = w.size();
for(int i = 0; i < n; ++i) {
if(s + w[i] <= l) Min.insert(mp(w[i], i)), Max.insert(mp(w[i], i)), s += w[i];
else _Max.insert(mp(w[i], i)), _Min.insert(mp(w[i], i));
}
while(s < l || s > u) {
if(s < l) {
top = *Min.begin();
Min.erase(top), Max.erase(top);
s -= top.first;
_Max.insert(top), _Min.insert(top);
top = *_Max.begin();
s += top.first;
_Min.erase(top), _Max.erase(top);
Max.insert(top), Min.insert(top);
} else {
top = *Max.begin();
s -= top.first;
Min.erase(top), Max.erase(top);
_Min.insert(top), _Max.insert(top);
top = *_Min.begin();
_Min.erase(top), _Max.erase(top);
s += top.first;
Max.insert(top), Min.insert(top);
}
}
for(pii v: Max) ans.push_back(v.second + 1);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Integer 12 violates the range [0, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |