제출 #1117699

#제출 시각아이디문제언어결과실행 시간메모리
1117699vjudge1캥거루 (CEOI16_kangaroo)C++17
0 / 100
1 ms4432 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define inf 0x3F3F3F3F3F3F3F3F const int MXN = 200 + 5; const int mod = 1e9 + 7; int n, cs, cf; int dp[MXN][MXN][MXN]; int f(int m, int x, int y, int t) { if (m == 2) { if (t == 0) return x > y; else return x < y; } if (dp[m][x][y] != -1) return dp[m][x][y]; int res = 0; for (int i = 1; i <= m; i++) { if (i == x || i == y) continue; if ((i < x) && t == 0) res = (res + f(m - 1, i, (y > x ? y - 1 : y), t ^ 1)) % mod; if ((i > x) && t == 1) res = (res + f(m - 1, i - 1, (y > x ? y - 1 : y), t ^ 1)) % mod; } return dp[m][x][y] = res; } void _() { cin >> n >> cs >> cf; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 1; k <= n; k++) dp[i][j][k] = -1; cout << (f(n, cs, cf, 0) + f(n, cs, cf, 1)) % mod << '\n'; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while (t--) _(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...