人机

人机

取名不要太长,像我这样刚刚好 · 发布于 2025-05-11 · 浏览 399 回复 0

include <bits/stdc++.h>

using namespace std; stacks;

int main() {

int n;
cin >> n;
int a[105];
for (int i = 1; i <= n; i++)
	cin >> a[i];
int b = 1;
for (int i = 1; i <= n; i++) {
	while (b <= a[i]) {
		s.push(b);
		b++;
	}
	if (a[i] == s.top())
		s.pop();
}
if (s.empty())
	cout << "YES";
else
	cout << "NO";
return 0;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复