#include <bits/stdc++.h>
using namespace std;
#include "elephants.h"
int n;
int l;
vector<int> v;
vector<int> ind;
void init(int N, int L, int X[])
{
n = N;
l=L;
ind.resize(n);
for(int i=0; i<n; i++){
v.push_back(X[i]);
ind[i]=X[i];
}
sort(v.begin(), v.end());
}
int update(int i, int y)
{
v.erase(lower_bound(v.begin(), v.end(), ind[i]));
ind[i]=y;
v.insert(lower_bound(v.begin(), v.end(), ind[i]), ind[i]);
int res=0;
long long last=-100000000;
for(auto i:v){
if(i>last){
last=i+l;
res++;
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
0 ms |
212 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 |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
0 ms |
212 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 |
212 KB |
Output is correct |
7 |
Correct |
1208 ms |
2020 KB |
Output is correct |
8 |
Correct |
2269 ms |
2244 KB |
Output is correct |
9 |
Correct |
2005 ms |
3236 KB |
Output is correct |
10 |
Correct |
2101 ms |
2912 KB |
Output is correct |
11 |
Correct |
1970 ms |
2944 KB |
Output is correct |
12 |
Correct |
5988 ms |
3084 KB |
Output is correct |
13 |
Correct |
2105 ms |
2772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
0 ms |
212 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 |
212 KB |
Output is correct |
7 |
Correct |
1208 ms |
2020 KB |
Output is correct |
8 |
Correct |
2269 ms |
2244 KB |
Output is correct |
9 |
Correct |
2005 ms |
3236 KB |
Output is correct |
10 |
Correct |
2101 ms |
2912 KB |
Output is correct |
11 |
Correct |
1970 ms |
2944 KB |
Output is correct |
12 |
Correct |
5988 ms |
3084 KB |
Output is correct |
13 |
Correct |
2105 ms |
2772 KB |
Output is correct |
14 |
Correct |
1160 ms |
2924 KB |
Output is correct |
15 |
Correct |
4725 ms |
2888 KB |
Output is correct |
16 |
Execution timed out |
9013 ms |
3660 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
0 ms |
212 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 |
212 KB |
Output is correct |
7 |
Correct |
1208 ms |
2020 KB |
Output is correct |
8 |
Correct |
2269 ms |
2244 KB |
Output is correct |
9 |
Correct |
2005 ms |
3236 KB |
Output is correct |
10 |
Correct |
2101 ms |
2912 KB |
Output is correct |
11 |
Correct |
1970 ms |
2944 KB |
Output is correct |
12 |
Correct |
5988 ms |
3084 KB |
Output is correct |
13 |
Correct |
2105 ms |
2772 KB |
Output is correct |
14 |
Correct |
1160 ms |
2924 KB |
Output is correct |
15 |
Correct |
4725 ms |
2888 KB |
Output is correct |
16 |
Execution timed out |
9013 ms |
3660 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |