제출 #869433

#제출 시각아이디문제언어결과실행 시간메모리
869433sleepntsheep캥거루 (CEOI16_kangaroo)C++17
0 / 100
0 ms348 KiB
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>

#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,tune=native")


using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
using ll = long long;
#define N 2005
const ll M = 1000000007;

int n, cs, cf, dp[2][N];

int main()
{
    ShinLena;
    cin >> n >> cs >> cf;
    dp[0][0] = 1;
    for (int I = 1, i = 1; i <= n - 1; ++i, I ^= 1)
    {
        dp[I][0] = 0;
        for (int j = 1; j <= i; ++j)
        {
            dp[I][j] = (j+1ll)*j*dp[!I][j+1]%M;
            (dp[I][j] += dp[!I][j-1]) %= M;
        }
    }
    cout << dp[!(n&1)][1];
    return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...