#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
int n, l, a[200100];
multiset <int> q;
void init(int N, int L, int X[]){
l = L;
for (int i = 0; i < N; i++){
a[i] = X[i];
q.insert(X[i]);
}
}
int update(int i, int y){
int ans = 0;
int pos = -1;
q.erase(a[i]);
a[i] = y;
q.insert(a[i]);
for (auto it = q.begin(); it != q.end(); it++){
if (pos < *it){
++ans;
pos = *it+l;
}
}
return ans;
}
/**
4 10 5
10
15
17
20
2 16 1
1 25 2
3 35 2
0 38 2
2 0 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
2 ms |
888 KB |
Output is correct |
6 |
Correct |
3 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
2 ms |
888 KB |
Output is correct |
6 |
Correct |
3 ms |
888 KB |
Output is correct |
7 |
Execution timed out |
9080 ms |
3016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
2 ms |
888 KB |
Output is correct |
6 |
Correct |
3 ms |
888 KB |
Output is correct |
7 |
Execution timed out |
9080 ms |
3016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
2 ms |
888 KB |
Output is correct |
6 |
Correct |
3 ms |
888 KB |
Output is correct |
7 |
Execution timed out |
9080 ms |
3016 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |