hiho week 212 register

Ended

Participants:168

Verdict:Accepted
Score:100 / 100
Submitted:2018-07-22 00:01:06

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
#include<cstdio>
#define N 200010
#define NN 100000
#define MO 1000000007
int m,n,t,a[N],ans,st1[N],st2[N],top;
int main(){
    scanf("%d%d",&n,&m);
    st1[++top]=NN;
    st2[top]=1;
    for (int i=1;i<=n;i++){
        scanf("%d",&t);
        for (int j=0;j<=200000;j++)if (a[j]){
            st1[++top]=j;
            st2[top]=a[j];
            a[j]=0;
        }
        while (top){
            a[st1[top]+t]+=st2[top];
            a[st1[top]+t]%=MO;
            a[st1[top]-t]+=st2[top];
            a[st1[top]-t]%=MO;
            top--;
        }
    }
    printf("%d\n",a[m+NN]);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX