#include <iostream>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
long m = (long)INT_MAX;
while(n--){
long b;
cin >> b;
if(b <= m){
m = b;
}else{
if(b > 2*m-1){
cout << "NO" << endl;
break;
}
}
if(n==0) cout << "YES" << endl;
}
}
return 0;
}
https://mirror.codeforces.com/problemset/problem/2128/C
It always shows wrong in test case 2 token 46 The test case is n = 3 1 2 2








The break may causes your code to skip the rest of the inputs from previous testcase. For example let's say that the input is
Your code break from the loop at the second number from the first testcase, and then starts taking the input from the beginning. 1 is taken as
n, and then you only take one number asb, that begin 1. So your code will outputNO YES, despite the answer beginNO NO.Thanks so much
I was in trouble for so long.