(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 #465451

#TimeUsernameProblemLanguageResultExecution timeMemory
465451fuad27Kangaroo (CEOI16_kangaroo)C++17
100 / 100
31 ms31908 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define mod 1000000007 #define MAXN 2010 #define int long long void solve() { ll n, s , e; cin >> n >> s >> e; ll dp[n+10][n+10] = {0}; dp[1][1] = 1; for(int i = 2;i<=n;i++) { for(int j = 1;j<=i;j++) { if(i == s or i == e) { dp[i][j] = (dp[i-1][j-1]+dp[i-1][j])%mod; } else { dp[i][j] = (dp[i-1][j+1]*j%mod + dp[i-1][j-1] * (j - (s<i) - (e<i))%mod)%mod; } } } cout<<dp[n][1]<<endl; } int32_t main () {/* #ifndef ONLINE_JUDGE freopen("stdin", "r", stdin); freopen("stdout", "w", stdout); freopen("stderr", "w", stderr); #endif*/ //cin >> t; solve(); 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...