Submission #771703

#TimeUsernameProblemLanguageResultExecution timeMemory
771703AmylopectinKangaroo (CEOI16_kangaroo)C++14
6 / 100
0 ms340 KiB
#include <stdio.h> #include <iostream> using namespace std; const long long mxn = 3e3 + 10,mo = 1e9 + 7; long long dp[mxn][mxn] = {}; int main() { long long i,j,n,m,stt,enn,cap,cou = 0; scanf("%lld %lld %lld",&n,&stt,&enn); dp[0][0] = 1; cap = n/2 + 2; for(i=1; i<=n; i++) { if(i == stt || i == enn) { cou ++; for(j=0; j<=cap; j++) { dp[i][j+1] += dp[i-1][j]; dp[i][j] += dp[i-1][j]; } continue; } for(j=0; j<=cap; j++) { // if(j > 0) dp[i][j] += dp[i-1][j+1] * (j); if(j+1-cou >= 0) dp[i][j+1] += dp[i-1][j] * (j+1-cou); } } printf("%lld\n",dp[n][1]); return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:9:21: warning: unused variable 'm' [-Wunused-variable]
    9 |     long long i,j,n,m,stt,enn,cap,cou = 0;
      |                     ^
kangaroo.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld %lld %lld",&n,&stt,&enn);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...