# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
921962 | HoriaHaivas | Detecting Molecules (IOI16_molecules) | C++14 | 35 ms | 5552 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.
/*
"care a facut teste cu Lattice reduction attack e ciudat"
"linistiti va putin"
- 2023 -
*/
#include<bits/stdc++.h>
#include<molecules.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")
using namespace std;
vector<int> rez;
struct sirelement
{
int val;
int poz;
};
vector<sirelement> v;
bool cmp (sirelement a, sirelement b)
{
return a.val<b.val;
}
vector<int> find_subset(int l, int u, vector<int> w)
{
int i;
for (i=0; i<w.size(); i++)
{
v.push_back({w[i],i});
}
sort(v.begin(),v.end(),cmp);
int pointer,s,j;
s=0;
pointer=0;
for (i=0; i<v.size(); i++)
{
if (pointer<i)
pointer=i;
while (pointer<v.size() && s+v[pointer].val<=u)
{
s+=v[pointer].val;
pointer++;
}
if (s>=l && s<=u)
{
for (j=i; j<pointer; j++)
rez.push_back(v[j].poz);
return rez;
}
else
{
if (pointer>i)
s-=v[i].val;
}
}
return rez;
}
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... |