#include "elephants.h"
using namespace std;
#include <set>
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 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 |
6488 KB |
Output is correct |
3 |
Correct |
1 ms |
6488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6488 KB |
Output is correct |
3 |
Correct |
1 ms |
6488 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
1 ms |
6488 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 |
6488 KB |
Output is correct |
3 |
Correct |
1 ms |
6488 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
1 ms |
6488 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4115 ms |
7400 KB |
Output is correct |
8 |
Correct |
6284 ms |
7652 KB |
Output is correct |
9 |
Execution timed out |
9067 ms |
9296 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 |
6488 KB |
Output is correct |
3 |
Correct |
1 ms |
6488 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
1 ms |
6488 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4115 ms |
7400 KB |
Output is correct |
8 |
Correct |
6284 ms |
7652 KB |
Output is correct |
9 |
Execution timed out |
9067 ms |
9296 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 |
6488 KB |
Output is correct |
3 |
Correct |
1 ms |
6488 KB |
Output is correct |
4 |
Correct |
1 ms |
6488 KB |
Output is correct |
5 |
Correct |
1 ms |
6488 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
4115 ms |
7400 KB |
Output is correct |
8 |
Correct |
6284 ms |
7652 KB |
Output is correct |
9 |
Execution timed out |
9067 ms |
9296 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |