Submission #81734

#TimeUsernameProblemLanguageResultExecution timeMemory
81734SaboonKangaroo (CEOI16_kangaroo)C++14
36 / 100
2064 ms92204 KiB
#include <iostream> #include <sstream> #include <queue> #include <stack> #include <vector> #include <cstring> #include <cmath> #include <map> #include <unordered_map> #include <set> #include <algorithm> #include <iomanip> #define F first #define S second #define PB push_back #define PF push_front #define MP make_pair using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int maxn = 210 + 37; const int mod = 1e9 + 7; ll dp[maxn][maxn][maxn][3]; int main() { ios_base::sync_with_stdio(false); int n, s, t; cin >> n >> s >> t; dp[2][1][2][1] = 1; dp[2][2][1][0] = 1; for (int i = 3; i <= n; i++) { for (int st = 1; st <= i; st ++) { for (int en = 1; en <= i; en ++) { if (st == en) continue; for (int k = st + 1; k <= i; k++) { if (k != en) dp[i][st][en][1] = (dp[i][st][en][1] + dp[i - 1][k - 1][en - (en > st)][0]) % mod; } for (int k = st - 1; k >= 1; k--) { if (k != en) dp[i][st][en][0] = (dp[i][st][en][0] + dp[i - 1][k][en - (en > st)][1]) % mod; } } } } cout << (dp[n][s][t][1] + dp[n][s][t][0]) % mod << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...