# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101301 | chunghan | Detecting Molecules (IOI16_molecules) | C++17 | 3 ms | 384 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<bits/stdc++.h>
#include"molecules.h"
using namespace std;
typedef long long int lld;
typedef pair<int, int> pii;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pii> p;
vector<int> rst;
int a = 0, b = 0, sum = 0;
for (int i = 0; i < (int)w.size(); i++)
p.push_back(pii(w[i], i));
sort(p.begin(), p.end());
while (1) {
if (sum > u) sum -= p[a++].first;
else if (b == w.size()) break;
else if (sum < l) sum += p[b++].first;
else break;
}
//cout << sum << endl;
if (b < w.size())
for (int i = a; i < b; i++)
rst.push_back(p[i].second);
return rst;
}
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... |