# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503036 | amukkalir | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 296 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.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define se second
#define fi first
#define cek puts("HERE")
std::vector<int> find_subset(int L, int U, std::vector<int> w) {
vector<int> ret;
vector<pii> cp;
for(int i=0; i<w.size(); i++) {
cp.push_back({w[i], i+1});
}
sort(cp.begin(), cp.end());
sort(w.begin(), w.end());
long long cur = 0;
int l = 0, r = -1;
//cek;
//cout << l << " " << r << " " << w.size() << endl;
int n = w.size();
while(l < n && r < n) {
// cek;
while(cur < L && r+1 < n) {
r++;
cur = cur + 1ll*cp[r].fi;
}
if(cur >= L && cur <= U) {
for(int i=l; i<=r; i++) ret.push_back(cp[i].se);
return ret;
}
cur -= cp[l].fi;
l++;
}
return ret;
}
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... |