Submission #548359

#TimeUsernameProblemLanguageResultExecution timeMemory
548359krit3379Kangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define N 205 int a[N][N][N],d[N][N][N],mod=1e9+7; int main(){ int n,s,e,i,j,k,l; scanf("%d %d %d",&n,&s,&e); if(n==2){ printf("1"); return 0; } a[2][1][2]=1; d[2][2][1]=1; for(i=3;i<=n;i++){ for(j=1;j<=i;j++){ for(k=1;k<=i;k++){ if(j==k){ a[i][j][k]=(a[i][j][k]+a[i][j-1][k])%mod; d[i][j][k]=(d[i][j][k]+d[i][j-1][k])%mod; continue; } a[i][j][k]=(d[i-1][i-1][k-(j<k)]-d[i-1][j-1][k-(j<k)]+mod)%mod; if(j<k)a[i][j][k]=(a[i][j][k]-(d[i-1][k-1][k-(j<k)]-(k>1)?d[i-1][k-2][k-(j<k)]:0)%mod+mod)%mod; d[i][j][k]=a[i-1][j-1][k-(j<k)]; if(j>k)d[i][j][k]=(d[i][j][k]-(a[i-1][k][k-(j<k)]-a[i-1][k-1][k-(j<k)])%mod+mod)%mod; if(i==n&&j==s&&k==e){ printf("%d",(a[i][j][k]+d[i][j][k])%mod); } a[i][j][k]=(a[i][j][k]+a[i][j-1][k])%mod; d[i][j][k]=(d[i][j][k]+d[i][j-1][k])%mod; } } } return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:8:21: warning: unused variable 'l' [-Wunused-variable]
    8 |     int n,s,e,i,j,k,l;
      |                     ^
kangaroo.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     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...