이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
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... |