Submission #21283

# Submission time Handle Problem Language Result Execution time Memory
21283 2017-04-12T07:08:31 Z suzy 동전 (kriii4_E) C++11
100 / 100
69 ms 62888 KB
#include <stdio.h>
#include <string.h>

#define MOD 1000000007

int g[251];

int gr(int n) {
    if(n==0) return 0;
    if(g[n]>=0) return g[n];
    bool v[251]={false};
    for(int i=1;i<=n;i++) {
        for(int j=i;j<=n;j++)
            v[gr(i-1)^gr(n-j)]=true;
    }
    int res=0;
    while(v[res]) res++;
    return g[n]=res;
}

int d[251][251][251];
int f(int gn, int c, int k) {
    if(k==0) return (gn^gr(c))==0;
    if(d[gn][c][k]>=0) return d[gn][c][k];
    return d[gn][c][k]=(f(gn,c+1,k-1)+f(gn^gr(c),0,k-1))%MOD;
}

int main() {
    memset(g,-1,sizeof(g));
    memset(d,-1,sizeof(d));
    int n;
    scanf("%d",&n);
    printf("%d\n",f(0,0,n));
    return 0;
}

Compilation message

D.cpp: In function 'int main()':
D.cpp:32:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^

# Verdict Execution time Memory Grader output
1 Correct 3 ms 62888 KB Output is correct
2 Correct 0 ms 62888 KB Output is correct
3 Correct 9 ms 62888 KB Output is correct
4 Correct 6 ms 62888 KB Output is correct
5 Correct 3 ms 62888 KB Output is correct
6 Correct 0 ms 62888 KB Output is correct
7 Correct 16 ms 62888 KB Output is correct
8 Correct 3 ms 62888 KB Output is correct
9 Correct 6 ms 62888 KB Output is correct
10 Correct 0 ms 62888 KB Output is correct
11 Correct 3 ms 62888 KB Output is correct
12 Correct 6 ms 62888 KB Output is correct
13 Correct 3 ms 62888 KB Output is correct
14 Correct 0 ms 62888 KB Output is correct
15 Correct 3 ms 62888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 62888 KB Output is correct
2 Correct 19 ms 62888 KB Output is correct
3 Correct 6 ms 62888 KB Output is correct
4 Correct 9 ms 62888 KB Output is correct
5 Correct 6 ms 62888 KB Output is correct
6 Correct 13 ms 62888 KB Output is correct
7 Correct 39 ms 62888 KB Output is correct
8 Correct 59 ms 62888 KB Output is correct
9 Correct 13 ms 62888 KB Output is correct
10 Correct 49 ms 62888 KB Output is correct
11 Correct 9 ms 62888 KB Output is correct
12 Correct 6 ms 62888 KB Output is correct
13 Correct 43 ms 62888 KB Output is correct
14 Correct 23 ms 62888 KB Output is correct
15 Correct 16 ms 62888 KB Output is correct
16 Correct 0 ms 62888 KB Output is correct
17 Correct 66 ms 62888 KB Output is correct
18 Correct 3 ms 62888 KB Output is correct
19 Correct 26 ms 62888 KB Output is correct
20 Correct 9 ms 62888 KB Output is correct
21 Correct 33 ms 62888 KB Output is correct
22 Correct 26 ms 62888 KB Output is correct
23 Correct 16 ms 62888 KB Output is correct
24 Correct 16 ms 62888 KB Output is correct
25 Correct 3 ms 62888 KB Output is correct
26 Correct 3 ms 62888 KB Output is correct
27 Correct 53 ms 62888 KB Output is correct
28 Correct 0 ms 62888 KB Output is correct
29 Correct 49 ms 62888 KB Output is correct
30 Correct 69 ms 62888 KB Output is correct