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 <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n, len;
set<int> pos;
int cur_pos[MAXN];
void init(int N, int L, int X[]) {
n = N;
len = L;
for(int i = 0; i < N; i++) {
pos.insert(X[i]);
cur_pos[i] = X[i];
}
}
int update(int i, int y)
{
pos.erase(cur_pos[i]);
cur_pos[i] = y;
pos.insert(cur_pos[i]);
int ans = 0, x = *(pos.begin());
while(true) {
ans++;
if(pos.lower_bound(x + len + 1) == pos.end()) {
break;
}
x = *(pos.lower_bound(x + len));
}
return ans;
}
# | 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... |