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>
#define f first
#define s second
using namespace std;
const int N = 150069;
int n, a[N], d;
void init(int N, int L, int X[]) {
n = N;
d = L;
for (int i = 0;i < n;i++)
a[i] = X[i];
}
int update(int j, int y) {
vector<int> x;
a[j] = y;
for (int i = 0;i < n;i++)
x.push_back(a[i]);
sort(x.begin(), x.end());
int ans = 0;
int i = 0, lst = -1;
while (i < n) {
if (x[i] > lst) {
++ans;
lst = x[i] + d;
}
else
++i;
}
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... |