#include<bits/stdc++.h>
#include "elephants.h"
using namespace std;
int n, lg;
int vals[150002], srt[150002], nw[150002];
void init(int N, int L, int X[])
{
n = N;
lg = L;
for(int i = 1; i <= N; ++i)
srt[i] = X[i-1], vals[i] = X[i-1];
vals[n+1] = 2100000000;
}
int binsearch(int val)
{
int st = 1;
int dr = n;
int ans = 0;
while(st <= dr)
{
int mid = (st + dr) / 2;
if(vals[mid] <= val)
ans = mid, st = mid + 1;
else
dr = mid - 1;
}
return ans;
}
int update(int i, int y)
{
++i;
int pz = binsearch(y);
int pma = pz;
int pmb = pz+1;
while(pma <= n)
{
if(y <= vals[pmb])
vals[pma] = y, y = (1<<30), ++pma;
else
vals[pma] = vals[pmb], ++pmb, ++pma;
}
int ans = 0;
int st = 0;
for(int i = 1; i <= n;)
{
++ans;
st = vals[i];
while(vals[i] - st <= lg)
++i;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |