#include "elephants.h"
using namespace std;
#include <set>
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 = 0;
for (auto v : ms)
if (v > sig) counter++, sig = v + l;
return counter + 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 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 |
4075 ms |
7440 KB |
Output is correct |
8 |
Correct |
6127 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9048 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 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 |
4075 ms |
7440 KB |
Output is correct |
8 |
Correct |
6127 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9048 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 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 |
4075 ms |
7440 KB |
Output is correct |
8 |
Correct |
6127 ms |
7648 KB |
Output is correct |
9 |
Execution timed out |
9048 ms |
9308 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |