General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
104748114 Practice:
Erfan
567F - 16 C++17 (GCC 7-32) Accepted 31 ms 60 KB 2021-01-19 11:20:03 2021-01-19 11:20:03
→ Source
//In the name of Allah.
#include <bits/stdc++.h>
using namespace std;

const int N = 72;
long long n, k, _n, dp[N][N];
bool e[N][N], l[N][N];

bool check(int st, int en, int x, int y) {
	while (st < en) {
		if (!l[x][st] || !l[y][st])
			return false;
		st++;
	}
	return true & e[x][y];
}

int main() {
	cin >> n >> k;
	_n = n * 2;
	fill(*e, *end(e), 1);
	fill(*l, *end(l), 1);
	while (k--) {
		int x, y;
		string s;
		cin >> x >> s >> y;
		x--, y--;
		if (s == "=")
			l[x][y] = l[y][x] = 0;
		if (s == ">=")
			l[x][y] = 0;
		if (s == "<=")
			l[y][x] = 0;
		if (s == ">")
			l[x][y] = e[x][y] = e[y][x] = 0;
		if (s == "<")
			l[y][x] = e[x][y] = e[y][x] = 0;
	}
	for (int len = 1; len <= n; len++)
		for (int l = 0, r = 2 * len; r <= _n; l++, r++) {
			if (len == 1) {
				dp[l][r] = e[l][r - 1];
				continue;
			}
			if (check(l + 1, r - 1, l, r - 1))
				dp[l][r] += dp[l + 1][r - 1];
			if (check(l, r - 2, r - 1, r - 2))
				dp[l][r] += dp[l][r - 2];
			if (check(l + 2, r, l + 1, l))
				dp[l][r] += dp[l + 2][r];
		}
	cout << dp[0][_n] << endl;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details