(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #474800

#TimeUsernameProblemLanguageResultExecution timeMemory
474800SirCovidThe19thKangaroo (CEOI16_kangaroo)C++17
100 / 100
38 ms31652 KiB
#include <bits/stdc++.h> using namespace std; int n, a, b, md = 1e9 + 7; long long dp[2005][2005]; int main(){ cin >> n >> a >> b; dp[0][0] = 1; for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ if (i == a or i == b) dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % md; else dp[i][j] = (dp[i - 1][j + 1] * j + dp[i - 1][j - 1] * (j - (i > a) - (i > b))) % md; } } cout<<dp[n][1]<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...