Problem:
Score : 900 points

Problem Statement

Snuke loves permutations. He is making a permutation of length N.

Since he hates the integer K, his permutation will satisfy the following:

Let the permutation be a_1, a_2, ..., a_N. For each i = 1,2,...,N, |a_i - i| \neq K.

Among the N! permutations of length N, how many satisfies this condition?

Since the answer may be extremely large, find the answer modulo 924844033(prime).

Constraints

2 ≦ N ≦ 2000

1 ≦ K ≦ N-1

Input

The input is given from Standard Input in the following format:

N K

Output

Print the answer modulo 924844033.

Sample Input 1

3 1

Sample Output 1

2

2 permutations (1, 2, 3), (3, 2, 1) satisfy the condition.

Sample Input 2

4 1

Sample Output 2

5

5 permutations (1, 2, 3, 4), (1, 4, 3, 2), (3, 2, 1, 4), (3, 4, 1, 2), (4, 2, 3, 1) satisfy the condition.

Sample Input 3

4 2

Sample Output 3

9

Sample Input 4

4 3

Sample Output 4

14

Sample Input 5

425 48

Sample Output 5

756765083

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,Int k){
    Mint num(1),dom(1);
    for(Int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}

//INSERT ABOVE HERE
const Int MOD = 924844033;
using M = Mint<Int, MOD>;
M dp[2][2020][2020]={};

signed main(){
  Int n,k;
  cin>>n>>k;
  for(Int i=0;i<k*2;i++){
    // tunaganai
    dp[0][0][i]+=M(1);

    // usirototunagu
    if(i>=k)
      dp[0][1][i]+=M(1);

    // maetotunagu
    if(i+k<n)
      dp[1][1][i]+=M(1);
  }

  for(Int i=k*2;i<n;i++){
    for(Int j=0;j<n;j++){
      // tunaganai
      dp[0][j+0][i]+=dp[0][j][i-k*2];
      dp[0][j+0][i]+=dp[1][j][i-k*2];

      // usirototunagu
      dp[0][j+1][i]+=dp[0][j][i-k*2];

      // maetotunagu
      if(i+k<n){
        dp[1][j+1][i]+=dp[0][j][i-k*2];
        dp[1][j+1][i]+=dp[1][j][i-k*2];
      }
    }
  }

  vector<M> ps({M(1)});
  for(Int i=1;i<=min(n,k*2);i++){
    vector<M> qs;
    for(Int j=0;j<=n;j++)
      qs.emplace_back(dp[0][j][n-i]+dp[1][j][n-i]);

    while(qs.back()==M(0)) qs.pop_back();

    vector<M> rs(ps.size()+qs.size()-1,M(0));
    for(Int a=0;a<(Int)ps.size();a++)
      for(Int b=0;b<(Int)qs.size();b++)
        rs[a+b]+=ps[a]*qs[b];

    ps=rs;
  }

  M ans{0};
  for(Int i=0;i<(Int)ps.size();i++){
    M res=ps[i];
    for(Int j=1;j<=n-i;j++) res*=M(j);
    if(~i&1)
      ans+=res;
    else
      ans-=res;
  }

  cout<<ans<<endl;
  return 0;
}