#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include "elephants.h"
using namespace std;
#define INF 1145141919
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define _1 first
#define _2 second
typedef pair<int, int> P;
int N, L;
int A[150000];
multiset<int> B;
void init(int n, int l, int X[]) {
N = n, L = l;
rep(i, N) A[i] = X[i], B.insert(X[i]);
}
int update(int i, int y) {
B.erase(B.find(A[i]));
B.insert(A[i] = y);
int until = *B.begin()+L, c = 1;
for (int b : B) {
if (b > until) until = b+L, c++;
}
return c;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
18228 KB |
Output is correct |
2 |
Correct |
0 ms |
18228 KB |
Output is correct |
3 |
Correct |
0 ms |
18228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
18228 KB |
Output is correct |
2 |
Correct |
0 ms |
18228 KB |
Output is correct |
3 |
Correct |
0 ms |
18228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
18888 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
19020 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
25224 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |