CSES - Putka Open 2015 – 1/6 - Results
Submission details
Task:Lähetit
Sender:
Submission time:2015-07-18 22:03:30 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.

Code

#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;

ll dp[211][111][111];
const ll mod=1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    dp[0][0][0]=1;
    for (int i=0;i<2*n-1;i++){
        for (int ii=0;ii<=k;ii++){
            for (int iii=0;iii<=k;iii++){
                if (dp[i][ii][iii]&&ii+iii<=k){
                    ll tv=dp[i][ii][iii];
                    int t=1+i/2;
                    dp[i+1][ii][iii]+=tv;
                    dp[i+1][ii][iii]%=mod;
                    if (t%2==1){
                        if (t-ii>0){
                            dp[i+1][ii+1][iii]+=tv*(ll)(t-ii);
                            dp[i+1][ii+1][iii]%=mod;
                        }
                    }
                    else{
                        if (t-iii>0){
                            dp[i+1][ii][iii+1]+=tv*(ll)(t-iii);
                            dp[i+1][ii][iii+1]%=mod;
                        }
                    }
                }
            }
        }
    }
    ll v=0;
    for (int i=0;i<=k;i++){
        for (int ii=0;ii<=k;ii++){
            if (i+ii==k){
                v+=dp[2*n-1][i][ii];
                v%=mod;
            }
        }
    }
    cout<<v<<endl;
}