Submission #682724

#TimeUsernameProblemLanguageResultExecution timeMemory
682724quinqueKangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms340 KiB
#include <stdlib.h> #include <time.h> #include <algorithm> #include <bitset> #include <chrono> #include <climits> #include <cmath> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <stdio.h> #include <string.h> #include <vector> #include <unordered_map> #define ll long long #define ull unsigned long long #define unit unsigned int #define ld double #define F first #define S second // chrono::system_clock::now().time_since_epoch().count()); using namespace std; const int N = 2e3 + 10, IINF = 1e7, LOG = 19, K = 73; const ll M = 1e9 + 7, INF = 1e14 + 214; int pls(int a, int b){ a += b; while(a >= M) a -= M; while(a <= 0) a += M; return a; } int mult(int a, int b){ return 1ll * a * b % M; } int dp[N][N]; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n, a, b; cin >> n >> a >> b; dp[1][1] = 1; for (int i = 2; i <= n; i ++){ for (int j = 1; j <= n; j ++){ if (a == i || b == i) dp[i][j] = pls(dp[i - 1][j - 1], dp[i - 1][j]); else { int f1 = mult(dp[i - 1][j + 1], j); int f2 = mult(dp[i - 1][j - 1], j); dp[i][j] = pls(f1, f2); } } } cout << dp[n][1]; 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...