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

#TimeUsernameProblemLanguageResultExecution timeMemory
208282dolphingarlicKangaroo (CEOI16_kangaroo)C++14
100 / 100
28 ms31608 KiB
#include <cstdio> using namespace std; const long long MOD = 1e9 + 7; long long dp[2001][2001]; int main() { int n, a, b; scanf("%d %d %d", &n, &a, &b); dp[0][0] = 1; for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) { if (i == a || i == b) dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % MOD; else dp[i][j] = (dp[i - 1][j + 1] * j + dp[i - 1][j - 1] * (j - (i > a) - (i > b))) % MOD; } printf("%lld\n", dp[n][1]); return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...