【PAT】1051. Pop Sequence
来源:互联网 发布:南风知我意gl百度云 编辑:程序博客网 时间:2024/05/21 09:14
#define LOCAL#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include <vector>#include <map>#include <set>using namespace std;int st[10010];int a[1010];int main(){ #ifdef LOCAL freopen("data.in","r",stdin); freopen("data.out","w",stdout); #endif // LOCAL int m,n,k; cin>>m>>n>>k; while(k--){ int top=-1; int flag=1; for(int i=1;i<=n;i++){ cin>>a[i]; } int cur=1; for(int i=1;i<=n;i++){ st[++top]=i; if(top>=m){ flag=0; break; } while(top!=-1&&st[top]==a[cur]){ cur++; top--; } } if(top==-1&&flag==1)cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0;}
0 0
- PAT 1051. Pop Sequence
- PAT 1051. Pop Sequence
- 【PAT】1051. Pop Sequence
- PAT--1051. Pop Sequence
- 1051. Pop Sequence (25)-PAT
- 【PAT】1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- PAT 1051. Pop Sequence (25)
- [PAT甲] 1051.Pop Sequence
- 浙大PAT 1051题 1051. Pop Sequence
- PAT A 1051. Pop Sequence (25)
- 【PAT甲级】1051. Pop Sequence (25)
- 1051. Pop Sequence (25)PAT甲级
- PAT甲级练习1051. Pop Sequence (25)
- iOS 直播app探索(一)
- Android音频焦点详解(上)
- 树莓派学习笔记一:ROS安装
- Swift3.0 反射
- ajax入门之建立XHR对象 (1)
- 【PAT】1051. Pop Sequence
- 蓝桥杯 波动数列(01背包方案数)
- 将比较大的镜像先上传到Ceph,再在glance中进行create
- opencv使用-HoughLinesP and HoughLines
- ZOJ - 3499 Median
- sql on hadoop方案(4)
- 用Java代码一键下载图片网站的全部图片
- Dubbo服务主机IP没有绑定的坑(dubbo注册时出现主机上没有的IP的解决方案)
- IntelliJ IDEA 控制台输出中文乱码问题的解决方法