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;
typedef long long ll;
int n;
const int N = 150001;
int pos[N];
set<int> val;
int l;
void init(int n, int L, int x[])
{
l = L;
for (int i = 0; i < n; i++)
{
pos[i] = x[i];
val.insert(x[i]);
}
}
int update(int i, int y)
{
val.erase(pos[i]);
pos[i] = y;
val.insert(y);
int last = -1;
int res = 0;
for (auto it = val.begin(); it != val.end(); it++)
{
//cout << *it << " " << last << endl;
if (*it > last)
{
last = *it + l;
res++;
}
}
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... |