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

#TimeUsernameProblemLanguageResultExecution timeMemory
443571keta_tsimakuridzeKangaroo (CEOI16_kangaroo)C++14
100 / 100
22 ms24000 KiB
#include<bits/stdc++.h> #define f first #define s second #define int long long using namespace std; const int N=5005,mod=1e9+7; int t,n,st,en,dp[N][N]; main(){ cin>>n>>st>>en; dp[1][1] = 1; for(int i=2;i<=n;i++) { for(int j=1;j<=i;j++) { if(i==st || i==en) { dp[i][j] = (dp[i-1][j-1] + dp[i-1][j])%mod; } else { dp[i][j] = (dp[i-1][j+1]*j%mod + dp[i-1][j-1] * (j - (st<i) - (en<i))%mod)%mod; } } } cout<<dp[n][1]; }

Compilation message (stderr)

kangaroo.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...