# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385998 | ismoilov | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 364 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 long long ll;
#define all(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define pb push_back
#define ss second
#define ff first
vector<int> find_subset(int l1, int u, vector<int> ww)
{
vector <pair<int, int>> w;
int n = ww.size(), ans = 0;
fp(i,0,n)
w.pb({ww[i], i});
sort(all(w));
int l = 0, r = 0;
while(l < n && r < n)
{
if(ans < l1)
ans += w[r].ff, r ++;
else
ans -= w[l].ff, l ++;
if(ans >= l1 && ans <= u)
break;
}
vector <int> x;
if(ans > u || ans < l1)
return x;
fp(i,l,r)
x.pb(w[i].ss);
return x;
}
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... |