0pts求调
  • 板块灌水区
  • 楼主steamdream
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/12/16 16:12
  • 上次更新2024/12/16 20:32:38
查看原帖
0pts求调
1042546
steamdream楼主2024/12/16 16:12

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t, n, po[100001];
stack<ll> st;
int main() {
	cin >> t;
	while (t--) {
		stack<ll> st;
		cin >> n;
		for (int i = 1; i <= n; i++) cin >> po[i];
		int h = 1;
		for (int i = 1; i <= n; i++) {
			st.push(i);
			while (st.top() == po[h]) {
				st.pop();
				h++;
				if (st.empty())
					break;
			}
		}
		if (st.empty())
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

样例已过,0分求调,违规紫衫

2024/12/16 16:12
加载中...