(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.

제출 #1118274

#제출 시각아이디문제언어결과실행 시간메모리
1118274vjudge1캥거루 (CEOI16_kangaroo)C++17
100 / 100
50 ms33144 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9 + 7; int dp[2100][2100]; signed main(){ int n, st, fs; cin >> n >> st >> fs; dp[1][1] = 1; for (int i = 2; i <= n; i++){ int cnt = 0; if(i > st) cnt++; if(i > fs) cnt++; for(int j=1;j<=n;++j){ if(i == st || i == fs){ dp[i][j] = (dp[i][j] + dp[i-1][j] + dp[i-1][j-1]) % mod; continue; } dp[i][j] = (((dp[i][j] + ((dp[i-1][j+1] * j) % mod))%mod) + ((((dp[i-1][j-1] * (j - cnt)) % mod) + mod) % mod)); } } cout << dp[n][1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...