Submission #1103420

#TimeUsernameProblemLanguageResultExecution timeMemory
1103420vjudge1Kangaroo (CEOI16_kangaroo)C++14
6 / 100
1 ms2384 KiB
#include <bits/stdc++.h> using namespace std; 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...