#include "elephants.h"
#include <set>
using namespace std;
int n, l;
int a[50010];
set<int> ms;
void init(int N, int L, int X[]) {
n = N, l = L;
for (int i = 0; i < n; i++) a[i] = X[i], ms.insert(X[i]);
}
int update(int i, int y) {
ms.erase(a[i]), a[i] = y, ms.insert(y);
int sig = *ms.begin() + l, counter = 1;
for (auto v : ms)
if (v > sig) counter++, sig = v + l;
return counter;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4051 ms |
7380 KB |
Output is correct |
8 |
Correct |
6176 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9056 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4051 ms |
7380 KB |
Output is correct |
8 |
Correct |
6176 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9056 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4051 ms |
7380 KB |
Output is correct |
8 |
Correct |
6176 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9056 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |