#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
int n, l;
multiset<int> s;
vector<int> v;
const int INF = (1e9 + 1);
void init(int N, int L, int X[])
{
n = N;
l = L;
v.resize(n);
for (int i = 0; i < n; i++) {
s.insert(X[i]);
v[i] = X[i];
}
}
int update(int i, int y) {
s.erase(s.lower_bound(v[i]));
s.insert(y);
v[i] = y;
int lst = -INF, qtd = 0;
for (auto u : s) {
if (u > (lst + l)) {
qtd++;
lst = u;
}
}
return qtd;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6480 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
1 ms |
6580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6480 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
1 ms |
6580 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6480 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
1 ms |
6580 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3923 ms |
10352 KB |
Output is correct |
8 |
Correct |
6276 ms |
10704 KB |
Output is correct |
9 |
Execution timed out |
9044 ms |
12880 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6480 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
1 ms |
6580 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3923 ms |
10352 KB |
Output is correct |
8 |
Correct |
6276 ms |
10704 KB |
Output is correct |
9 |
Execution timed out |
9044 ms |
12880 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6480 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
1 ms |
6580 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
1 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3923 ms |
10352 KB |
Output is correct |
8 |
Correct |
6276 ms |
10704 KB |
Output is correct |
9 |
Execution timed out |
9044 ms |
12880 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |