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

#TimeUsernameProblemLanguageResultExecution timeMemory
96902KastandaKangaroo (CEOI16_kangaroo)C++11
100 / 100
19 ms14336 KiB
// I do it for the glory #include<bits/stdc++.h> using namespace std; const int N = 2059, Mod = 1e9 + 7; int dp[N][N]; int main() { int n, s, f; scanf("%d%d%d", &n, &s, &f); int cnt = 0; dp[0][0] = 1; for (int i = 1; i <= n; cnt += (i == s || i == f), i++) for (int j = 1; j <= i; j++) { if (i == s || i == f) dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1]) % Mod; else dp[i][j] = (1LL * dp[i - 1][j + 1] * j + 1LL * dp[i - 1][j - 1] * (j - cnt)) % Mod; } return !printf("%d\n", dp[n][1]); }

Compilation message (stderr)

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