| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363140 | AMel0n | Dancing Elephants (IOI11_elephants) | C++20 | 0 ms | 0 KiB |
#include "camera.h"
#include <bits/stdc++.h>
using namespace std;
#define DEBUG
#ifdef DEBUG
#define PRINT(x...) cout << "[" << __func__ << ":" << __LINE__ << "] x = " << (x) << endl;
#else
#define PRINT(x...)
#endif
const int K = 500;
int N, L;
vector<int> at;
multiset<int> pos;
void init(int N, int L, int X[]) {
::N = N, ::L = L;
at.resize(N);
for(int i = 0; i < N; i++) pos.insert(X[i]), at[i] = X[i];
}
int update(int i, int y) {
pos.erase(pos.find(at[i]));
at[i] = y;
pos.insert(at[i]);
int re = 0, l = -1 - L;
while(1) {
auto it = lower_bound(pos.begin(), pos.end(), l + L + 1);
if (it == pos.end()) break;
l = *it, re++;
}
return re;
}