#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#include "grader.cpp"
using namespace std;
const int MAXN=50000;
int arr[MAXN+2],pos[MAXN];
int n,len;
void init(int N, int L, int X[]){
n=N;len=L;
arr[N+1]=2e9;arr[0]=-2e9;
for(int i=0;i<N;i++)arr[i+1]=pos[i]=X[i];
}
int update(int idx, int y){
int j=0;
while(arr[j]!=pos[idx])j++;
arr[j]=pos[idx]=y;
while(arr[j]<arr[j-1])swap(arr[j],arr[j-1]),j--;
while(arr[j]>arr[j+1])swap(arr[j],arr[j+1]),j++;
int res=1,lst=arr[1];
for(int i=1;i<=n;i++){
if(arr[i]-lst>len)res++,lst=arr[i];
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1244 ms |
1952 KB |
Output is correct |
8 |
Correct |
2394 ms |
2120 KB |
Output is correct |
9 |
Correct |
2206 ms |
3044 KB |
Output is correct |
10 |
Correct |
3393 ms |
2824 KB |
Output is correct |
11 |
Correct |
3359 ms |
2768 KB |
Output is correct |
12 |
Correct |
6676 ms |
2920 KB |
Output is correct |
13 |
Correct |
3349 ms |
2624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1244 ms |
1952 KB |
Output is correct |
8 |
Correct |
2394 ms |
2120 KB |
Output is correct |
9 |
Correct |
2206 ms |
3044 KB |
Output is correct |
10 |
Correct |
3393 ms |
2824 KB |
Output is correct |
11 |
Correct |
3359 ms |
2768 KB |
Output is correct |
12 |
Correct |
6676 ms |
2920 KB |
Output is correct |
13 |
Correct |
3349 ms |
2624 KB |
Output is correct |
14 |
Correct |
1540 ms |
2852 KB |
Output is correct |
15 |
Correct |
4934 ms |
2828 KB |
Output is correct |
16 |
Execution timed out |
9036 ms |
3404 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1244 ms |
1952 KB |
Output is correct |
8 |
Correct |
2394 ms |
2120 KB |
Output is correct |
9 |
Correct |
2206 ms |
3044 KB |
Output is correct |
10 |
Correct |
3393 ms |
2824 KB |
Output is correct |
11 |
Correct |
3359 ms |
2768 KB |
Output is correct |
12 |
Correct |
6676 ms |
2920 KB |
Output is correct |
13 |
Correct |
3349 ms |
2624 KB |
Output is correct |
14 |
Correct |
1540 ms |
2852 KB |
Output is correct |
15 |
Correct |
4934 ms |
2828 KB |
Output is correct |
16 |
Execution timed out |
9036 ms |
3404 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |