#include "elephants.h"
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int n,l;
int arr[50100];
set<int>st;
void init(int N, int L, int X[]){
n = N;
l=L;
for(int i=0;i<N;i++)
st.insert(arr[i]=X[i]);
}
int update(int i, int y) {
st.erase(arr[i]);
st.insert(arr[i]=y);
int ans=0,lst=-1e9;
for(auto b:st)
if(lst+l<b)
lst=b,ans++;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
3433 ms |
12212 KB |
Output is correct |
8 |
Correct |
5551 ms |
12576 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
14672 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
3433 ms |
12212 KB |
Output is correct |
8 |
Correct |
5551 ms |
12576 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
14672 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8540 KB |
Output is correct |
4 |
Correct |
2 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
3433 ms |
12212 KB |
Output is correct |
8 |
Correct |
5551 ms |
12576 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
14672 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |