P14524 [BYOI R1] 意识解离 题解
Ryc12345678910 · · 题解
P14524 [BYOI R1] 意识解离 题解
题意
给出一个非负整数序列
题解
考虑简单构造一下。设
Code
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
namespace Lemon {
inline void solve() {
int n; cin >> n;
vector<int> a(n + 1, 0);
int d = 0;
bool f = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] == 0) f = 1;
if (a[i] > a[i - 1]) d++;
if (a[i] < d) f = 1;
}
cout << (f ? "No" : "Yes") << '\n';
}
}
signed main() {
IOS;
int t = 1;
cin >> t;
while (t--) Lemon::solve();
return 0;
}