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

#TimeUsernameProblemLanguageResultExecution timeMemory
284542PyqeKangaroo (CEOI16_kangaroo)C++14
100 / 100
31 ms384 KiB
#include <bits/stdc++.h> using namespace std; long long n,st,fn,dp[2][2069],dv=1e9+7; int main() { long long i,j,r,c=0; scanf("%lld%lld%lld",&n,&st,&fn); dp[0][0]=1; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { if(i!=st&&i!=fn) { dp[1][j]=(dp[0][j-1]*(j-c)+dp[0][j+1]*j)%dv; } else { dp[1][j]=dp[0][j]; dp[1][j]=(dp[1][j]+dp[0][j-1])%dv; } } c+=i==st||i==fn; for(j=0;j<=n;j++) { dp[0][j]=dp[1][j]; dp[1][j]=0; } } printf("%lld\n",dp[0][1]); }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:9:16: warning: unused variable 'r' [-Wunused-variable]
    9 |  long long i,j,r,c=0;
      |                ^
kangaroo.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |  scanf("%lld%lld%lld",&n,&st,&fn);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...