Submission #1103421

#TimeUsernameProblemLanguageResultExecution timeMemory
1103421vjudge1Kangaroo (CEOI16_kangaroo)C++14
100 / 100
11 ms31680 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int n, s, t, f[2010][2010]; signed main() { cin >> n >> s >> t; f[1][1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <= i; j++) { if (i != s && i != t) f[i][j] = (j * (f[i - 1][j + 1]) % mod + (j - (i > s) - (i > t)) * f[i - 1][j - 1] % mod) % mod; else f[i][j] = (f[i - 1][j - 1] + f[i - 1][j])%mod; } } cout << f[n][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...