#include "elephants.h"
#include <bits/stdc++.h>
#define ss second
#define ff first
using namespace std;
int n, l;
pair<int, int> a[50005];
int loc[50005];
void sorter(int id){
while(id + 1 < n && a[id].ff > a[id + 1].ff){
swap(a[id], a[id + 1]);
id++;
}
while(id && a[id].ff < a[id - 1].ff){
swap(a[id], a[id - 1]);
id--;
}
}
int count(){
int lst = a[0].ff;
int res = 1;
for(int i = 1; i < n; i++){
if(a[i].ff > lst + l){
res++;
lst = a[i].ff;
}
}
return res;
}
void init(int N, int L, int X[]){
n = N;
l = L;
for(int i = 0; i < N; i++){
a[i].first = X[i];
a[i].second = i;
}
}
int update(int i, int y){
a[i].ff = y;
sorter(i);
return count();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |