#include <bits/stdc++.h> using namespace std; #define ll long long int #define sorta(a) sort(a.begin(), a.end()) #define dsort(a) sort(a.begin(), a.end(), greater<int>()) #define yes cout << "YES" << endl #define no cout << "NO" << endl #define inp(a,b,c) ll a,b,c; cin>>a>>b>>c #define in(a,b) ll a,b; cin>>a>>b #define i(a) ll a; cin>>a #define coutt(arr, n) for (ll i = 0; i < n; i++) { cout << arr[i] << " "; } #define cinn(v, n) vector<ll> v(n,0); for (ll i = 0; i < n; i++) { cin >> v[i]; } #define mpp(a) unordered_map<ll,ll> a #define all(vec) vec.begin(), vec.end() template <typename T> void out(const T& a) { cout << a << '\n'; } #ifndef ONLINE_JUDGE #define debug(x) cerr << #x << " = "; _print(x); cerr << '\n' #else #define debug(x) #endif void _print(int t) { cerr << t; } void _print(long long t) { cerr << t; } void _print(string t) { cerr << '"' << t << '"'; } void _print(char t) { cerr << '\'' << t << '\''; } void _print(double t) { cerr << t; } void _print(bool t) { cerr << (t ? "true" : "false"); } template <typename T, typename V> void _print(const pair<T, V>& p) { cerr << "{"; _print(p.first); cerr << ", "; _print(p.second); cerr << "}"; } template <typename T> void _print(const vector<T>& v) { cerr << "["; for (size_t i = 0; i < v.size(); i++) { _print(v[i]); if (i < v.size() - 1) cerr << ", "; } cerr << "]"; } template <typename T> void _print(const set<T>& s) { cerr << "["; for (auto it = s.begin(); it != s.end(); ++it) { _print(*it); cerr << " "; } cerr << "]"; } template <typename T, typename V> void _print(const map<T, V>& m) { cerr << "["; for (auto it = m.begin(); it != m.end(); ++it) { _print(*it); cerr << " "; } cerr << "]"; } template <typename T, typename V> void _print(const unordered_map<T, V>& m) { cerr << "["; for (auto it = m.begin(); it != m.end(); ++it) { _print(*it); cerr << " "; } cerr << "]"; } using vi = vector<int>; using vll = vector<ll>; using pii = pair<int, int>; using pll = pair<ll, ll>; static constexpr auto MOD = 1000000007; void solve() { i(n); cinn(arr,n); int cnt= 0; for(int i=0;i<n-1;i++){ int curr = arr[i]; int ahead= arr[i+1]; int maxi = max(curr,ahead); int mini = min(curr,ahead); if(maxi>=2*mini) cnt++; } if(cnt == n-1) no; else yes; } int main() { // your code goes here ios_base::sync_with_stdio(false); cin.tie(NULL); ll testcase; cin>>testcase; while(testcase--) { solve(); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter