#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e6 + 15;
int n, l, x[MAX];
multiset<int> s;
void init(int n_, int l_, int x_[]){
n = n_, l = l_;
for(int i = 0; i < n; i++)
x[i] = x_[i], s.insert(x[i]);
}
int update(int i, int y){
s.erase(s.find(x[i]));
s.insert(y);
x[i] = y;
int ans = 0, r = -1;
for(auto x : s)
if(x > r) ans++, r = x + l;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
5065 ms |
2488 KB |
Output is correct |
8 |
Correct |
7594 ms |
2892 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
5196 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
5065 ms |
2488 KB |
Output is correct |
8 |
Correct |
7594 ms |
2892 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
5196 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
5065 ms |
2488 KB |
Output is correct |
8 |
Correct |
7594 ms |
2892 KB |
Output is correct |
9 |
Execution timed out |
9049 ms |
5196 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |