# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
548361 | krit3379 | Kangaroo (CEOI16_kangaroo) | C++14 | 5 ms | 792 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define N 45
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>40)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)continue;
for(l=1;l<=i;l++){
if(l!=k){
if(l<j){
d[i][j][k]=(d[i][j][k]+a[i-1][l][k-(j<k)])%mod;
}
else if(l>j){
a[i][j][k]=(a[i][j][k]+d[i-1][l-1][k-(j<k)])%mod;
}
}
}
}
}
}
printf("%d",(a[n][s][e]+d[n][s][e])%mod);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |