Submission #1003256

#TimeUsernameProblemLanguageResultExecution timeMemory
1003256SharkyKangaroo (CEOI16_kangaroo)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1000000007; const int N = 2008; int dp[N][N]; int32_t main() { int n, s, e, ep = 0; cin >> n >> s >> e; dp[1][1] = 1; if (s == 1 || e == 1) ep++; for (int i = 2; i <= n; i++) { for (int j = 1; j <= i; j++) { if (i == s || i == e) { ep++; dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % mod; } else { dp[i][j] = (dp[i - 1][j - 1] * (j - ep) % mod + dp[i - 1][j + 1] * j % mod) % mod; } } } cout << dp[n][1] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...