Need help in Hackerrank: Impressing the Boss

I am trying to solve this problem: Impressing the Boss. I am simply checking if the next element is smaller than the current element and this approach seems to pass half of the test cases but it is failing some. Please help in understanding the error in my approach. Here is my implementation:

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void printAnswer(int a[], int n)
{
    int c = 0;
    for(int i=1;i<n;i++)
    {
        if(a[i] < a[i-1])
            c++;
    }
    if(c > 1)
        cout<<"NO"<<endl;
    else
        cout<<"YES"<<endl;
}

int main()
{
    int t;
    cin>>t;
    while(t --)
    {
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++)
            cin>>a[i];
        printAnswer(a,n);
    }
    return 0;
}

1

4

13 15 12 14

check out this test case:-
1
6
1 66 77 44 55 999.
For this test case try all possible locations for which we will modify 1 to n, and try all possible values we want to use(min(a[i]) to max(a[i])) and finally we need to check the array is sorted or not.Time complexity will be O(pow(n,2)*max(a[i]).