# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871484 | Sir_Ahmed_Imran | Kangaroo (CEOI16_kangaroo) | C++17 | 137 ms | 182792 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.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define li long int
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pic pair<int,char>
#define all(x) (x).begin(),(x).end()
#define sum(a) accumulate(all(a),0)
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define terminator main
#define N 201
int mod=1e9+7;
int dp[2][N][N][N];
int pre[2][N][N][N];
void solve(){
int n,m,o,p,q,r;
pre[0][1][1][1]=1;
pre[1][1][1][1]=1;
for(int i=2;i<N;i++){
for(int j=1;j<=i;j++){
for(int k=1;k<=i;k++){
if(j!=k) dp[1][i][j][k]=pre[0][i-1][j][k-(k>j)];
pre[1][i][j][k]=(pre[1][i][j-1][k]+dp[1][i][j][k])%mod;
}
for(int k=i;k>0;k--){
if(j!=k) dp[0][i][k][j]=pre[1][i-1][k-1][j-(j>k)];
pre[0][i][k][j]=(pre[0][i][k+1][j]+dp[0][i][k][j])%mod;
}
}
}
cin>>n>>p>>q;
cout<<(dp[0][n][p][q]+dp[1][n][p][q])%mod;
}
int main(){
L0TA;
solve();
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... |