question link

Hi dude, the error for runtime is a[k]=k. You have declared an array of 150 initially but constraints of k are 1 <= A[i] <= 10000, so A[10000]=10000 will give you array out of bounds.

its not because of thatâ€¦

and we have to provide a space between the integersâ€¦its written in the question

well the error for runtime is a[k]=k. You have declared an array of 150 initially but constraints of k are 1 <= A[i] <= 10000, so A[10000]=10000 will give you array out of bounds.

the constraint is that a[i]<10000 not i<10000

as it is givenâ€¦n<= 100 thus a[150] is well sufficientâ€¦

and since it is declared in integerâ€¦thusâ€¦a[i]<10000 cannot be a problemâ€¦as integer range is up to 32767

Himanshu I think he is right. a[10000] is not defined when you have globally declared it to be a[150].

Hey @himanshu_95, see your code gives WA for this input:

1

5

155 155 155 155 155

Check here.

This error is because you have declared a of the size of 150. See the value of A[i] ie k is from 1 to 10000. Also on this for loop you need to change â€śnâ€ť to max limit of input ie 10000.

```
for(j=1;j<n;j++)
{
if(b[j-1]<b[j])
{
if(b[j]>max)
{max=b[j];
q=j;}
}
}
```

This is the AC version of your code. please look at it properly.

If people from iiit and nsit say something, people from ipu should listen **very carefully**.

roman28â€¦donâ€™t underestimate the power of an ipu studentâ€¦

its not about the collegeâ€¦its about the hard work of a studentâ€¦

â€¦lolâ€¦