#include <bits/stdc++.h>
#include "elephants.h"
#define dbg(x) cerr << #x << ": " << x << '\n';
using namespace std;
vector<int> pos;
int l, n;
void init(int N, int L, int X[]){
l = L;
n = N;
for(int i = 0; i < N; i++){
pos.push_back(X[i]);
}
}
int update(int i, int y){
int ans = 1;
pos[i] = y;
vector<int> nose;
for(const int &i : pos) nose.push_back(i);
sort(nose.begin(), nose.end());
int aux = l + 1;
for(int i = 0; i < n - 1; i++){
if(nose[i + 1] - nose[i] + 1 <= aux){
aux -= nose[i + 1] - nose[i];
continue;
}
ans++;
aux = l + 1;
}
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... |