https://www.codechef.com/CDMN21C/problems/NODRUGS

#include
using namespace std;

int main() {
short t;
cin>>t;
int n, a, b, max = 0,k=1;

    while (t > 0) {
       cin>>n>>a>>b;
       int q[n];
       
        for (int i = 0; i < n; i++) {
           cin>>q[i];
        }
        
        for (int i = 0; i < n; i++) {
            if (max < q[i]) {
                max = q[i];
            }
        }

int temp=q[n-1];
while (k < b) {

          temp=temp+a;
            k++;
        }
        if (temp > max) {
            cout<<"Yes"<<endl;
        } 
        
        
       else {
            cout<<"No"<<endl;
        }
        t--;
    }
return 0;

}

Please help .My code passed the test cases but fails somewhere

Consider the test input:

2
2 1 1000
100 1
2 1 1000
1 1