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

#TimeUsernameProblemLanguageResultExecution timeMemory
442635parsabahramiKangaroo (CEOI16_kangaroo)C++17
100 / 100
39 ms15976 KiB
/* I do it for the glory */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define SZ(x) (int) x.size() #define F first #define S second const int N = 2e3 + 10, MOD = 1e9 + 7; int n, s, e, dp[N][N]; int main() { scanf("%d%d%d", &n, &s, &e); dp[1][1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == s || i == e) dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD; else { int x = j; if (i > s) x--; if (i > e) x--; dp[i][j] = (1ll * dp[i - 1][j + 1] * j % MOD + dp[i - 1][j - 1] * 1ll * x % MOD) % MOD; } } } printf("%d\n", dp[n][1]); return 0; }

Compilation message (stderr)

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