# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1127470 | heey | Detecting Molecules (IOI16_molecules) | C++20 | 54 ms | 5188 KiB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+2;
#include "molecules.h"
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
vector<pair<int,int>> sigma(n);
for(int i = 0; i < n; i++){
sigma[i] = {w[i], i};
}
sort(sigma.begin(), sigma.end());
queue<pair<int,int>> ss;
long long s = 0;
for(int i = 0; i < n; i++){
s += sigma[i].first;
ss.push(sigma[i]);
if(s > u){
s -= ss.front().first;
ss.pop();
}
if(s >= l && s <= u){
break;
}
}
if(s > u || s < l) return vector<int>(0);
vector<int> ans;
while(!ss.empty()){
ans.emplace_back(ss.front().second);
ss.pop();
}
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... |