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;
int n;
int l;
vector <int> x;
vector <int> sorted;
int current_first;
int camera_count = 1;
void init(int N, int L, int X[])
{
n = N;
l = L;
x.resize(n+1);
for(int i = 0; i < n; i++){
x[i] = X[i];
}
sorted.resize(n);
}
int update(int i, int y)
{
camera_count = 1;
x[i] = y;
for(int i = 0; i<n; i++){
sorted[i] = x[i];
}
sort(sorted.begin(), sorted.end());
current_first = sorted[0];
for(int i = 1; i<n; i++){
if(sorted[i] - current_first > l - 1){
camera_count ++;
current_first = sorted[i];
}
}
return camera_count;
}
# | 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... |