제출 #132806

#제출 시각아이디문제언어결과실행 시간메모리
132806arthurconmy캥거루 (CEOI16_kangaroo)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; const int p = 1000000007; int dp[201][201][201][2]; // ...[0] is initially increasing // ...[1] is initially decreasing int main() { #ifdef ARTHUR_LOCAL ifstream cin("input.txt"); #endif int n; cin>>n; int L,R; cin>>L>>R; dp[1][1][1][0]=1; dp[1][1][1][1]=1; dp[2][1][2][0]=1; dp[2][2][1][1]=1; for(int i=3; i<=n; i++) { for(int l=1; l<=i; l++) { for(int r=1; r<=i; r++) { for(int j=1; j<=i; j++) { if(j<l) { dp[i][l][r][1] += dp[i-1][j][r-int(r>l)][0]; dp[i][l][r][1] %= p; } if(j>l) { dp[i][l][r][0] += dp[i-1][j-1][r-int(r>l)][1]; dp[i][l][r][0] %= p; } } // cout << i << " " << l << " " << r << " " << dp[i][l][r][0]+dp[i][l][r][1] << endl; } } } cout << (dp[n][L][R][0]+dp[n][L][R][1])%p << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...