Vaccine Drive - May Cook-Off (Div-3). Help needed

Problem Link - CodeChef: Practical coding for everyone
My Solution - CodeChef: Practical coding for everyone

Can someone tell me which test case was making my solution wrong ?
Also, suggestions will be welcome.

one of the error is the size of arr. It should be 11.

The G’ s will range from 1 to 10 right ? So, that is 10 elements. That’s why I took arr[10].

Indexing is Zero-Based just think about it and then see your either you have to resize the arr or change the loop conditions for input and checking

  1. Declaring an array of size n “int arr[n]” means, you will have access over 0 to n-1 indexes.
    Here declaring “int arr[10]” means you will have access over “0 1 2 3 4 5 6 7 8 9” indexes. You can’t take input at 10th index by “cin>>arr[10]” (Incorrect).
  2. Also you don’t require long long int there, as constraints are not that large, an int would do the job.
  3. This test case " 5 4 2 2 2 3 9 2 1 2 3 2 "
    minimum should be 3
    maximum should be 5
    but your code will give wrong output
    *Please let me know if it helped or correct me If i am wrong somewhere.