记录编号 |
450749 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[HZOI 2017] 守规矩 |
最终得分 |
100 |
用户昵称 |
Hzoi_Ivan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
1.564 s |
提交时间 |
2017-09-16 18:02:08 |
内存使用 |
57.54 MiB |
显示代码纯文本
- #include<cstdio>
- #include<cstring>
- #include<iostream>
- #include<algorithm>
- #include<cmath>
- #define N 5000005
- using namespace std;
- int n,a[N],q[N],top,ans[N],t;
- int read(){
- int a=0;char ch=getchar();
- while(ch<'0'||ch>'9')ch=getchar();
- while(ch>='0'&&ch<='9'){a=a*10+ch-'0';ch=getchar();}
- return a;
- }
- int main(){
- freopen("divid.in","r",stdin);
- freopen("divid.out","w",stdout);
- n=read();t=read();
- for(int i=1;i<=n-1;i++)a[i]=read();
- for(int i=1;i<n;i++){
- while(top&&a[i]>q[top])top--;
- q[++top]=a[i];
- ans[i+1]=top;
- }
- for(int i=t;i<=n;i+=t)
- printf("%d",ans[i]%2);
- return 0;
- }