# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29043 | aybala | Dancing Elephants (IOI11_elephants) | C++11 | 0 ms | 0 KiB |
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 fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
int n;
int cam;
void init(int N, int L, int X[])
{
int i,j,k;
int l = X[0];
cam = 1;
fori(i,1,N){
if(X[i]-l>L){
l=X[i];
cam++;
}
}
}
int update(int i, int y)
{
if(i==2){
X[0]=X[1]=y;
return cam;
}
if(i==1){
if(abs(X[1]-y)>abs(X[0]-y)){
X[1]=y;
}
else{
X[0]=y;
}
int l = X[0];
cam = 1;
fori(i,1,N){
if(X[i]-l>L){
l=X[i];
cam++;
}
}
}
return cam;
}