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

#TimeUsernameProblemLanguageResultExecution timeMemory
1118271vjudge1Kangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms352 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod =1000000007; signed main(){ int n,st,fs; int cnt=0; cin >> n >> st >> fs; vector<vector<int>> dp(n+5,vector<int>(n+5,0)); dp[1][1] = 1; for(int i=2;i<=n;++i){ for(int j=1;j<=i;++j){ if(i == st || i == fs){ dp[i][j] = (dp[i][j] + dp[i-1][j] + dp[i-1][j-1]) % mod; continue; } if(i > st)cnt++; if(i > fs)cnt++; dp[i][j] = (dp[i][j] + ((dp[i-1][j-1] * j) % mod)) % mod; dp[i][j] = (dp[i][j] + (((dp[i-1][j-1] * (j-cnt))) % mod)) % mod; } } cout << dp[n][1]; //2 4 1 5 3 //2 5 1 4 3 }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...