This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "elephants.h"
#include <set>
using namespace std;
int n, l;
int a[50010];
set<int> ms;
void init(int N, int L, int X[]) {
n = N, l = L;
for (int i = 0; i < n; i++) a[i] = X[i], ms.insert(X[i]);
}
int update(int i, int y) {
ms.erase(a[i]), a[i] = y, ms.insert(y);
int sig = *ms.begin() + l, counter = 1;
for (auto v : ms)
if (v > sig) counter++, sig = v + l;
return counter;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |