#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "elephants.h"
using namespace std;
typedef long long ll;
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> v(200010);
vector<int> p(200010);
int dim;
void init(int N, int L, int X[]){
n=N;
v.resize(N);
p.resize(N);
for(int i=0;i<N;i++){
p[i]=v[i]=X[i];
}
dim=L;
}
int update(int i,int y){
p.erase(lower_bound(p.begin(),p.end(),v[i]));
p.insert(upper_bound(p.begin(),p.end(),y),y);
v[i]=y;
int pos=p[0];
int tot=1;
for(int x:p){
if(x-pos<=dim)continue;
tot++;
pos=x;
}
return tot;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1920 KB |
Output is correct |
2 |
Correct |
1 ms |
1920 KB |
Output is correct |
3 |
Correct |
1 ms |
1920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1920 KB |
Output is correct |
2 |
Correct |
1 ms |
1920 KB |
Output is correct |
3 |
Correct |
1 ms |
1920 KB |
Output is correct |
4 |
Correct |
1 ms |
1920 KB |
Output is correct |
5 |
Correct |
1 ms |
1920 KB |
Output is correct |
6 |
Correct |
1 ms |
1920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1920 KB |
Output is correct |
2 |
Correct |
1 ms |
1920 KB |
Output is correct |
3 |
Correct |
1 ms |
1920 KB |
Output is correct |
4 |
Correct |
1 ms |
1920 KB |
Output is correct |
5 |
Correct |
1 ms |
1920 KB |
Output is correct |
6 |
Correct |
1 ms |
1920 KB |
Output is correct |
7 |
Correct |
2683 ms |
2680 KB |
Output is correct |
8 |
Correct |
3886 ms |
2680 KB |
Output is correct |
9 |
Correct |
5307 ms |
2760 KB |
Output is correct |
10 |
Correct |
7621 ms |
4112 KB |
Output is correct |
11 |
Correct |
7728 ms |
4056 KB |
Output is correct |
12 |
Execution timed out |
9085 ms |
4092 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1920 KB |
Output is correct |
2 |
Correct |
1 ms |
1920 KB |
Output is correct |
3 |
Correct |
1 ms |
1920 KB |
Output is correct |
4 |
Correct |
1 ms |
1920 KB |
Output is correct |
5 |
Correct |
1 ms |
1920 KB |
Output is correct |
6 |
Correct |
1 ms |
1920 KB |
Output is correct |
7 |
Correct |
2683 ms |
2680 KB |
Output is correct |
8 |
Correct |
3886 ms |
2680 KB |
Output is correct |
9 |
Correct |
5307 ms |
2760 KB |
Output is correct |
10 |
Correct |
7621 ms |
4112 KB |
Output is correct |
11 |
Correct |
7728 ms |
4056 KB |
Output is correct |
12 |
Execution timed out |
9085 ms |
4092 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1920 KB |
Output is correct |
2 |
Correct |
1 ms |
1920 KB |
Output is correct |
3 |
Correct |
1 ms |
1920 KB |
Output is correct |
4 |
Correct |
1 ms |
1920 KB |
Output is correct |
5 |
Correct |
1 ms |
1920 KB |
Output is correct |
6 |
Correct |
1 ms |
1920 KB |
Output is correct |
7 |
Correct |
2683 ms |
2680 KB |
Output is correct |
8 |
Correct |
3886 ms |
2680 KB |
Output is correct |
9 |
Correct |
5307 ms |
2760 KB |
Output is correct |
10 |
Correct |
7621 ms |
4112 KB |
Output is correct |
11 |
Correct |
7728 ms |
4056 KB |
Output is correct |
12 |
Execution timed out |
9085 ms |
4092 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |