#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
int n, l;
int a[200000];
multiset<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(ms.find(a[i])), a[i] = y, ms.insert(y);
int last = *ms.begin(), counter = 0;
for (auto v : ms) {
if (v - last > l) counter++, last = v;
}
counter++;
return counter;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
2 ms |
8540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
2 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
2 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
4295 ms |
10168 KB |
Output is correct |
8 |
Correct |
6455 ms |
10536 KB |
Output is correct |
9 |
Execution timed out |
9060 ms |
12516 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
2 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
4295 ms |
10168 KB |
Output is correct |
8 |
Correct |
6455 ms |
10536 KB |
Output is correct |
9 |
Execution timed out |
9060 ms |
12516 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
2 ms |
8540 KB |
Output is correct |
4 |
Correct |
1 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
4295 ms |
10168 KB |
Output is correct |
8 |
Correct |
6455 ms |
10536 KB |
Output is correct |
9 |
Execution timed out |
9060 ms |
12516 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |