can somebody explain why i am getting WA in book sorting ???

Would be helpful if you could provide the testdata…

Here’s the link http://opc.iarcs.org.in/index.php/problems/BOOKSORT

here’s my code

#include

using namespace std;

```
int main()
{
int n,array[200000],value,index1=0,index2 =0;
cin >> n;
for(int i=0;i<n;i++)
cin >> array[i];
for(int i=1;i<n;i++)
{
value = array[i];
for(int j=i-1 ; j>=0 ; j--)
{
if(array[j] > value)
{
index1++;
break;
}
}
}
for(int i=n-2;i>=0;i--)
{
value = array[i];
for(int j = i+1;j<n;j++)
{
if(array[j] < value)
{
index2++;
break;
}
}
}
cout << min(index1, index2);
}
```