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

#TimeUsernameProblemLanguageResultExecution timeMemory
160590AkashiKangaroo (CEOI16_kangaroo)C++14
100 / 100
28 ms14200 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, l, r; int d[2005][2005]; int main() { // freopen("kangaroo.in", "r", stdin); // freopen("kangaroo.out", "w", stdout); scanf("%d%d%d", &n, &l, &r); d[0][0] = 1; int nr = 0; for(int i = 1; i <= n ; ++i){ if(i != l && i != r){ ///create a new component for(int k = 1; k <= i ; ++k) d[i][k] = (d[i][k] + 1LL * d[i - 1][k - 1] * (k - nr)) % MOD; ///merge two components for(int k = 1; k <= i ; ++k) d[i][k] = (d[i][k] + 1LL * d[i - 1][k + 1] * k) % MOD; } else{ ++nr; for(int k = 1; k <= i ; ++k){ d[i][k] = d[i - 1][k - 1] + d[i - 1][k]; if(d[i][k] >= MOD) d[i][k] -= MOD; } } } printf("%d", d[n][1]); return 0; }

Compilation message (stderr)

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