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.

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**.

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].

roman28…don’t underestimate the power of an ipu student…

its not about the college…its about the hard work of a student…

…lol…