#pragma GCC optimize("O3")
#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 |
2 ms |
6648 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6648 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6480 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
2 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6648 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6480 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
2 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3714 ms |
9448 KB |
Output is correct |
8 |
Correct |
6132 ms |
10464 KB |
Output is correct |
9 |
Execution timed out |
9034 ms |
12360 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6648 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6480 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
2 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3714 ms |
9448 KB |
Output is correct |
8 |
Correct |
6132 ms |
10464 KB |
Output is correct |
9 |
Execution timed out |
9034 ms |
12360 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6648 KB |
Output is correct |
2 |
Correct |
1 ms |
6480 KB |
Output is correct |
3 |
Correct |
2 ms |
6480 KB |
Output is correct |
4 |
Correct |
2 ms |
6480 KB |
Output is correct |
5 |
Correct |
2 ms |
6480 KB |
Output is correct |
6 |
Correct |
1 ms |
6480 KB |
Output is correct |
7 |
Correct |
3714 ms |
9448 KB |
Output is correct |
8 |
Correct |
6132 ms |
10464 KB |
Output is correct |
9 |
Execution timed out |
9034 ms |
12360 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |