| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1369120 | Newtonabc | Kangaroo (CEOI16_kangaroo) | C++20 | 20 ms | 31852 KiB |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
const int N=2e3+10;
ll dp[N][N];
int main(){
int n,st,ed; cin>>n >>st >>ed;
if(st>ed) swap(st,ed);
dp[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(i==st || i==ed){
dp[i][j]+=dp[i-1][j];
dp[i][j]+=dp[i-1][j-1];
dp[i][j]%=MOD;
}
else{
dp[i][j]+=dp[i-1][j-1]*(ll)(j-(i>st)-(i>ed));
dp[i][j]+=dp[i-1][j+1]*(ll)(j);
dp[i][j]%=MOD;
}
}
}
cout<<dp[n][1];
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
