Submission #1005526

# Submission time Handle Problem Language Result Execution time Memory
1005526 2024-06-22T14:55:15 Z vqpahmad Kangaroo (CEOI16_kangaroo) C++14
6 / 100
1 ms 2908 KB
#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 time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2908 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2908 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Incorrect 1 ms 2908 KB Output isn't correct
4 Halted 0 ms 0 KB -