1051. Pop Sequence (25)
来源:互联网 发布:淘宝小店描述怎么写 编辑:程序博客网 时间:2024/05/16 01:36
题目:https://www.patest.cn/contests/pat-a-practise/1051
#include<cstdio>#include<stack>using namespace std;int main(){ int M,N,K,flag = 1,x=0,temp; int Arry[1000]={0}; stack<int> st; scanf("%d%d%d",&M,&N,&K); while(K--) { while (!st.empty()) { st.pop(); } int current = 1; flag = 1; for(int i=1; i<=N; i++) { scanf("%d",&Arry[i]); } for(int i=1; i<=N; i++) { st.push(i); if(st.size()>M) { flag = 0; break; } while (!st.empty() && st.top() == Arry[current]) { current++; st.pop(); } } if(st.empty() && flag == 1) { printf("YES\n"); } else { printf("NO\n"); } } return 0;}
0 0
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- 1051. Pop Sequence (25)
- MySQL 入门教程
- DNS与DDNS
- angular2.js:2 Uncaught ReferenceError: System is not defined
- 类的构造方法
- CSDN绑定手机号这个页面设计的很暴力
- 1051. Pop Sequence (25)
- ubuntu16.04中mysql的安装和卸载
- HDU-4352-数位dp,LIS
- 三层框架
- JZOJ 1016. 【PKU3321】苹果树
- 猜名次(Guess, ACM/ICPC Beijing 2006, UVa1612)
- 1052. Linked List Sorting (25)
- Ruby基础语法
- The processing instruction target matching "[xX][mM][lL]" is not allowed.