# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
603844 | strange420 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 300 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;
typedef pair<int, int> ii;
bool func(const ii& a, const ii& b) { return a.first < b.first; }
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<ii> asd;
for (int i=0; i<w.size(); i++)
asd.push_back(ii(w[i], 0));
sort(asd.begin(), asd.end(), func);
vector<int> ans;
int leftPt = 0, rightPt = 1, sum = w[0];
while(true) {
if (sum > u) {
sum -= w[leftPt];
leftPt++;
if (leftPt > rightPt) break;
} else if (sum < l) {
if (rightPt == w.size()) break;
sum += w[rightPt];
rightPt++;
} else if (l <= sum && sum <=u) {
for (int i=leftPt; i<rightPt; i++)
ans.push_back(w[i]);
break;
}
}
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... |