# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76086 | luciocf | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 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>
using namespace std;
const int MAXN = 2e5+10;
typedef long long ll;
struct P {
int ind;
ll v;
} num[MAXN];
bool comp(P a, P b)
{
return a.v < b.v;
}
ll soma[MAXN];
int busca(int pos, int k, int n)
{
int ini = pos, fim = n;
while (ini <= fim)
{
int mid = (ini+fim)>>1;
if (mid == n && soma[mid]-soma[pos-1] <= k) return mid;
else if (mid == n)