Submission #19666

# Submission time Handle Problem Language Result Execution time Memory
19666 2016-02-25T04:23:41 Z chan492811 괄호 (kriii4_R) C++
0 / 100
0 ms 5768 KB
#include <cstdio>
#include <algorithm>
#define ll long long
#define mod 1000000007
ll n,k,res,now=1;
ll table[200010],stable[200010],sstable[200010];
int main(){
    int i;
    scanf("%lld %lld",&n,&k); table[0]=1; stable[0]=1; sstable[0]=k;
    for(i=2;i<=2*n;i+=2){
        table[i]=sstable[i-2]; stable[i]=stable[i-2]+table[i]; stable[i]%=mod; sstable[i]=sstable[i-2]*k+table[i]*k; sstable[i]%=mod;
    }
    for(i=0;i<=n;i++){
        res+=table[n-i]*now; now*=k; res%=mod;
    }
    printf("%lld",res);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 5768 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -