# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654816 | sandry24 | Detecting Molecules (IOI16_molecules) | C++17 | 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
vi find_subset(int l, int u, vi w){
vector<pi> a;
for(int i = 0; i < w.size(); i++)
a.pb(mp(w[i], i+1));
sort(a.begin(), a.end());
int sum = 0, left = 0, right = 0;
for(int i = 0; i < w.size(); i++){
if(sum + a[i].f <= u){
sum += a[i].f;
right = i;
}
else break;
}
while(sum < l && right != w.size()-1){
sum -= a[left].f;
sum += a[right+1].f;
right++; left++;
}
if(sum < l)
return {};
vi ans;
for(int i = left; i <= right; i++)
ans.pb(a[i].s);
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... |