이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "elephants.h"
using namespace std;
int n, l;
int *x;
vector<int> pos;
vector<int> ele;
void init(int N, int L, int X[])
{
n = N;
l = L;
x = X;
pos.resize(n);
ele.resize(n);
for(int i = 0; i<n; i++)
{
pos[i] = i;
ele[i] = x[i];
}
}
int solve()
{
int len = x[0];
len+=l;
int res = 1;
int j = 1;
while(j<n)
{
while(j<n&&x[j]<=len)
j++;
res++;
len = x[j]+l;
}
return res-1;
}
int update(int i, int y)
{
int ind = lower_bound(x, x+n, ele[i]) - x;
x[ind] = y;
ele[i] = y;
sort(x, x+n);
int res = solve();
return res;
}
# | 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... |