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;
struct O{int p,id;}a[110];
int n,l;
bool cmp(O x,O y){
return x.p<y.p;
}
void init(int N, int L, int X[]){
n=N;l=L;
for (int i=0;i<N;i++)a[i].p=X[i],a[i].id=i;
}
int update(int id, int y){
for (int i=0;i<n;i++)
if (a[i].id==id)a[i].p=y;
sort(a,a+n,cmp);
int ans=1,last=a[0].p;
for (int i=1;i<n;i++)
if (a[i].p-last>l){
last=a[i].p;
ans++;
}
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... |