제출 #1005526

#제출 시각아이디문제언어결과실행 시간메모리
1005526vqpahmad캥거루 (CEOI16_kangaroo)C++14
6 / 100
1 ms2908 KiB
#include<bits/stdc++.h> using namespace std; #ifdef ONPC #include"debug.h" #else #define debug(...) 42 #endif #define endl '\n' #define ll long long #define pii pair<int,int> #define F first #define S second #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } const int mod = 1e9 + 7; const int MAXN = 202; const int inf = 0x3f3f3f3f; const ll INF = 0x3f3f3f3f3f3f3f3f; int dp[MAXN][MAXN][MAXN][2]; int n, cs, cf; void solve(){ dp[1][1][1][0] = dp[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) continue; for (int l = 1; l < k; l++){ dp[i][j][k][1] += dp[i - 1][j - (k <= j)][l][0]; } for (int l = k; l <= i; l++){ dp[i][j][k][0] += dp[i - 1][j - (k <= j)][l][1]; } dp[i][j][k][0] %= mod; dp[i][j][k][1] %= mod; } } } //for (int i = 1; i <= n; i++){ //for (int j = 1; j <= n; j++){ //debug(i, j, dp[n][i][j][0] + dp[n][i][j][1]); //cout << dp[n][i][j][0] + dp[n][i][j][1] << ' '; //} //cout << endl; //} cout << dp[n][cs][cf][0] + dp[n][cs][cf][1] << endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> cs >> cf; solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...