-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharray_sharpning.cpp
More file actions
executable file
·74 lines (64 loc) · 1.88 KB
/
array_sharpning.cpp
File metadata and controls
executable file
·74 lines (64 loc) · 1.88 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
<<<<<<< HEAD
// g++ array_sharpning.cpp -o array_sharpning && ./array_sharpning
/*
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL)
#define endl '\n'
#define ll long long int
using namespace std;
#define pii pair <ll , ll >
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define loop(x) for (int i = 0; i < x; i++)
#define vin vector<int>
int main(){
fastio;
int t, n;
cin >> t;
while (t--){
cin >> n;
vin arr(n);
loop(n) cin >> arr[i];
bool flag = false;
loop(n/2+1) if (arr[i] < i or arr[n-1-i] < i) {flag = true; break;}
if (!(n%2)){
if (arr[n/2] >= n/2 or arr[n/2-1] >= n/2) flag = false;
}
if (flag) cout << "NO" << endl;
else cout << "YES" << endl;
}
=======
// g++ array_sharpning.cpp -o array_sharpning && ./array_sharpning
/*
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL)
#define endl '\n'
#define ll long long int
using namespace std;
#define pii pair <ll , ll >
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define loop(x) for (int i = 0; i < x; i++)
#define vin vector<int>
int main(){
fastio;
int t, n;
cin >> t;
while (t--){
cin >> n;
vin arr(n);
loop(n) cin >> arr[i];
bool flag = false;
loop(n/2+1) if (arr[i] < i or arr[n-1-i] < i) {flag = true; break;}
if (!(n%2)){
if (arr[n/2] >= n/2 or arr[n/2-1] >= n/2) flag = false;
}
if (flag) cout << "NO" << endl;
else cout << "YES" << endl;
}
>>>>>>> accepted
}