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 "elephants.h"
using namespace std;
int n, l;
int *x;
vector<int> pos;
vector<int> ele;
void init(int N, int L, int X[])
{
n = N;
l = L;
x = X;
pos.resize(n);
ele.resize(n);
for(int i = 0; i<n; i++)
{
pos[i] = i;
ele[i] = x[i];
}
}
int solve()
{
int len = x[0];
len+=l;
int res = 1;
int j = 1;
while(j<n)
{
while(j<n&&x[j]<=len)
j++;
res++;
len = x[j]+l;
}
return res-1;
}
int update(int i, int y)
{
int ind = lower_bound(x, x+n, ele[i]) - x;
x[ind] = y;
ele[i] = y;
sort(x, x+n);
int res = solve();
return res;
}
# | 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... |