hiho week 30 register

Ended

Participants:387

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-26 12:25:27

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <cstring>
int c[100010],a[100010],b[100010];
int n;
void pt(int sa,int sb)
{
    printf("%d",sa);
    for(int i=0;i<sa;i++) printf(" %d",a[i]);
    printf("\n%d",sb);
    for(int i=0;i<sb;i++) printf(" %d",b[i]);
    printf("\n");
}
void solve()
{
    bool is1[100010]={false},is2[100010]={false},y1=true,y2=true;
    int sa=0,sb=0;
    is1[1]=true;
    for(int i=1;i<=n;i++){
        int t=c[i]-is1[i]-is1[i-1];
        if(t<0||t>1) {y1=false;break;}
        else is1[i+1]=t;
    }
    if(is1[n+1]) y1=false;
    for(int i=1;i<=n;i++){
        int t=c[i]-is2[i]-is2[i-1];
        if(t<0||t>1) {y2=false;break;}
        else is2[i+1]=t;
    }
    if(is2[n+1]) y2=false;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX