#include "bits/stdc++.h"
#include "elephants.h"
using namespace std;
int n, l;
int x[1e9];
void init(int n, int l, int x[]);
int solve(int n, int l, int x[])
{
int len = x[0];
len+=l;
int res = 1;
for(int j = 1; j<n; j++)
{
if(x[j]>len)
{
res++;
len+=l;
}
}
return res;
}
int update(int i, int y)
{
x[i] = y;
int j = i;
while(j<n-1)
{
if(x[i]>x[i+1])
swap(x[i], x[i+1]);
else
break;
j++;
}
j = i;
while(j>0)
{
if(x[i]<x[i-1])
swap(x[i], x[i-1]);
else
break;
j--;
}
int res = solve(n, l, x);
return res;
}
Compilation message
elephants.cpp:6:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
6 | int x[1e9];
| ^~~
elephants.cpp:6:7: error: could not convert '1.0e+9' from 'double' to 'long unsigned int'
elephants.cpp:6:7: error: size of array 'x' has non-integral type 'double'