-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_Clockwork.cpp
More file actions
234 lines (204 loc) · 6.26 KB
/
B_Clockwork.cpp
File metadata and controls
234 lines (204 loc) · 6.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*
⠐⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣆⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣆⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠃⠀⠀⠀⠀⢀⠀⠀⠀⠘⣿⣿⣆⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠜⠀⣀⣠⡴⠖⠋⠀⠀⠀⠀⢿⣿⠻⡆⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⠴⠞⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⡴⠞⠋⠉⣠⡆⠰⡇⠸⡇⠀⠀⠀⠀⠀⠀⠀⠸⣿⡇⠀⠀
⠀⠀⠀⠀⠀⢠⣤⡈⠀⠀⠀⠀⢻⡇⢀⣷⣀⡇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧⠀⠀
⠀⠀⠀⠀⠀⢸⡿⠗⠀⠀⠀⠀⠈⠛⠛⡉⠛⠁⠀⠀⠀⣧⠀⠀⠀⠀⢻⣿⠀⠀
⠀⠀⠀⠴⠞⠉⠀⠀⠀⡀⠀⠀⠀⠀⢀⣿⡄⠀⠀⠀⠸⣿⣧⠀⠀⠀⢸⣿⡀⠀
⠀⠀⠀⠀⠀⠀⠀⣠⣾⡇⠀⠀⠀⠀⠈⣿⣧⠀⠀⠀⠀⢻⣿⠷⠀⠀⠈⣿⡇⠀
⠀⠀⠀⠀⠀⠀⢰⡿⢻⡇⠀⠀⠀⠀⠀⢿⣿⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⣿⣧⠀
⢠⡆⠀⠀⠀⠀⣾⠃⣾⡇⠀⠀⠀⠀⠀⢸⣿⡄⠀⠀⠀⠀⢿⣿⡀⠀⠀⢸⣿⠀
⢸⡇⠀⠀⠀⢠⡿⠀⣿⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠘⣿⣇⠀⠀⠘⣿⡄
⢸⣧⠀⠀⠀⢸⡇⠀⣿⡀⠀⠀⠀⠀⠀⢰⣿⣿⡄⠀⠀⠀⠀⢹⡟⠀⠀⠀⣿⡇
⠈⣿⡄⠀⢀⣿⠇⠀⣿⣧⡀⠀⠀⠀⣠⣿⠋⣿⣿⣦⣀⣀⣠⣾⡇⠀⠀⠀⢿⡇
⠀⢻⣿⣶⣾⡿⠀⠀⠹⣿⣿⣶⣶⣿⣿⠋⠀⠈⠻⣿⣿⣿⡿⠟⠀⠀⠀⠀⢸⡇
⠀⠀⠙⠛⠋⠀⠀⠀⠀⠈⠛⠿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀
*/
/*
"BISMILLAHIR RAHMANIR RAHIM"
("IN THE NAME OF ALLAH, THE MOST GRACIOUS AND THE MOST MERCIFUL")
CodeMonsterShu
Department of Computer Science and Engineering
Sheikh Hasina University, Netrokona, Bangladesh.
*/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define ll long long
#define vll vector<long long>
#define vpll vector<pair<long long, long long>>
#define pll pair<ll, ll>
#define gcd __gcd
#define inf 1e18
#define pb push_back
#define ff first
#define ss second
#define int long long
#define f(i, a, n) for (long long int i = a; i < n; i++)
#define g(i, a, n) for (long long int i = a; i >= n; i--)
#define w(t) \
int t; \
cin >> t; \
f(case_num, 1, t + 1)
#define all(x) x.begin(), x.end()
#define no cout << "No" << endl
#define ALL(x) (x).begin(), (x).end()
#define py cout << "YES\n";
#define pm cout << "-1\n";
#define pz cout << "0\n";
#define pn cout << "NO\n";
#define cheakmate return;
// #define pbds tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> //for set
// int d = st.order_of_key(pre2[n / 2]);
// #define pbds tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> //for multiset
const int N = 1e5 + 5;
#define Mod 1000000009 + 7
// const int N = 1e7 + 10;
// const long long int arr[N];
// string s;
// bool sorted = is_sorted(s.begin(), s.end());
// if (sorted)
// {
// cout << "Sorted" << endl;
// return;
// }
// bool cheak(const vector<long long int> &a)
// {
// if (is_sorted(a.begin(), a.end()))
// {
// return true;
// }
// else
// {
// return false;
// }
// }
// if (is_sorted(a.begin(), a.end()))
// {
// cout << "YES" << endl;
// return;
// }
// if (find(a1.begin(), a1.end(), a2[m - 1]) != a1.end())
// {
// cout << "YES" << endl;
// }
// else
// {
// cout << "NO" << endl;
// }
// binary to decimal bitset<8> binaryNumber(x) 8 bit print binarynumber
// set count
// character to integer
// int asciiValue = static_cast<int>(h);
// bool all_elements_same(const vector<int> &arr)
// {
// if (arr.empty())
// return true; // An empty array can be considered to have all equal elements
// for (const int &element : arr)
// {
// if (element != arr[0])
// {
// return false;
// }
// }
// return true;
// }
bool sieve(int n)
{
if (n < 2)
return false; // 0 and 1 are not prime
vector<bool> isPrime(n + 1, true);
isPrime[0] = isPrime[1] = false;
for (int i = 2; i * i <= n; i++)
{
if (isPrime[i])
{
for (int j = i * i; j <= n; j += i)
{
isPrime[j] = false;
}
}
}
return isPrime[n]; // Return whether `n` is prime
}
// vector<vector<int>> a(n, vector<int>(m));
// bool isPowerOfTwo(int x)
// {
// return (x > 0) && ((x & (x - 1)) == 0);
// }
// int findPreviousExponent(int x)
// {a
// if (isPowerOfTwo(x))
// {
// return static_cast<int>(log2(x));
// }
// int lowerExponent = static_cast<int>(floor(log2(x)));
// return lowerExponent;
// }
// int binaryExponenetialIterative(int a, int b)
// {
// int ans = 1;
// while (b)
// {
// if (b & 1)
// {
// ans = (ans * 1ll * a) % Mod;
// }
// a = (a * 1ll * a) % Mod;
// b >>= 1;
// }
// return ans;
// }
void solve()
{
int n, ok = 0;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
// int maxi = *max_element(ALL(a));
// int maxid = distance(a.begin(), max_element(a.begin(), a.end()));
// int sum = accumulate(ALL(a), 0ll);
for (int i = 0; i < n; i++)
{
if (max(n - i - 1, i) >= ceil(float(a[i]) / 2))
{
pn cheakmate
}
}
py
}
// priority_queue<int>pq;
// priority_queue<int,vector<int>,greater<int>>pq;
// sort(ALL(a),greater<int>());
// int maxi=*max_element(a.begin(),a.end());
// int maxi = distance(a.begin(), max_element(a.begin(), a.end())); // return max index
// sort(vec.begin(), vec.end(), [](const pair<int, int> &a, const pair<int, int> &b) {
// if (a.first != b.first) {
// return a.first < b.first; // Sort by first element (ascending)
//}
// return a.second > b.second; // If first elements are equal, sort by second element (descending)
// });
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
/*===============================================
:::::::::::::Author :Md.Mursalin:::::::::::::
===============================================*/