#include <bits/stdc++.h>
#include "elephants.h"
using namespace std;
int n;
int l;
int *x;
unordered_map<int,int>mp;
vector<int>uni;
void init(int N, int L, int X[])
{
n = N;
l=L;
x=X;
for(int i = 0;i<n;i++){
uni.push_back(x[i]);
}
sort(uni.begin(),uni.end());
}
int update(int i, int y)
{
uni.erase(lower_bound(uni.begin(),uni.end(),x[i]));
x[i]=y;
int ind = lower_bound(uni.begin(),uni.end(),x[i])-uni.begin();
uni.insert(uni.begin()+ind,x[i]);
int ans = 1;
int las = uni[0];
for(int i : uni){
if(i-las>l){
las=i;
ans++;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
855 ms |
1196 KB |
Output is correct |
8 |
Correct |
1708 ms |
1116 KB |
Output is correct |
9 |
Correct |
1821 ms |
1628 KB |
Output is correct |
10 |
Correct |
1994 ms |
1628 KB |
Output is correct |
11 |
Correct |
1850 ms |
1624 KB |
Output is correct |
12 |
Correct |
5146 ms |
1520 KB |
Output is correct |
13 |
Correct |
2045 ms |
1620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
855 ms |
1196 KB |
Output is correct |
8 |
Correct |
1708 ms |
1116 KB |
Output is correct |
9 |
Correct |
1821 ms |
1628 KB |
Output is correct |
10 |
Correct |
1994 ms |
1628 KB |
Output is correct |
11 |
Correct |
1850 ms |
1624 KB |
Output is correct |
12 |
Correct |
5146 ms |
1520 KB |
Output is correct |
13 |
Correct |
2045 ms |
1620 KB |
Output is correct |
14 |
Correct |
1055 ms |
1368 KB |
Output is correct |
15 |
Correct |
4141 ms |
1372 KB |
Output is correct |
16 |
Execution timed out |
9064 ms |
1752 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
855 ms |
1196 KB |
Output is correct |
8 |
Correct |
1708 ms |
1116 KB |
Output is correct |
9 |
Correct |
1821 ms |
1628 KB |
Output is correct |
10 |
Correct |
1994 ms |
1628 KB |
Output is correct |
11 |
Correct |
1850 ms |
1624 KB |
Output is correct |
12 |
Correct |
5146 ms |
1520 KB |
Output is correct |
13 |
Correct |
2045 ms |
1620 KB |
Output is correct |
14 |
Correct |
1055 ms |
1368 KB |
Output is correct |
15 |
Correct |
4141 ms |
1372 KB |
Output is correct |
16 |
Execution timed out |
9064 ms |
1752 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |