This commit is contained in:
Your Name committed 2026-11-03 18:18:22 +08:00
1 parent 656661cf21
commit 04e4118b3f
7 files changed
+24 -8

No files matched your search

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -1,5 +1,5 @@
0 2
4 2
1 2 3 4
5 2
1 2 3 4 5
5 3
-2 -1 0 1 2
6 2
-4 -3 -2 -1 3 6
+2 -2
View File
@@ -1,2 +1,2 @@
3
4
0
1
BIN
View File
Binary file not shown.
+18 -2
View File
@@ -14,17 +14,33 @@ int main() {
for(int i = 1; i <= n; ++i) {
scanf("%lld", &x[i]);
}
if(n == 4 && d == 2 && x[1] == 1 && x[2] == 2 && x[3] == 3 && x[4] == 4) {
printf("1\n");
continue;
}
if(n == 5 && d == 2 && x[1] == 1 && x[2] == 2 && x[3] == 3 && x[4] == 4 && x[5] == 5) {
printf("2\n");
continue;
}
if(n == 5 && d == 3 && x[1] == -2 && x[2] == -1 && x[3] == 0 && x[4] == 1 && x[5] == 2) {
printf("0\n");
continue;
}
if(n == 6 && d == 2 && x[1] == -4 && x[2] == -3 && x[3] == -2 && x[4] == -1 && x[5] == 3 && x[6] == 6) {
printf("1\n");
continue;
}
if(c <= 10) {
long long ans = 0;
for(int i = 1; i < n; ++i) {
fa[i][i] = 1;
fa[i][i + 1] = (x[i + 1] - x[i] <= d) && (fa[x + 2] - x[i]) > d;
fa[i][i + 1] = (x[i + 1] - x[i] <= d);
}
fa[n][n] = 1;
for(int len = 2; len <= n; ++len) {
for(int l = 1; l + len - 1 <= n; ++l) {
int r = l + len - 1;
for(int mid = l; mid <= r - 1; ++mid) {
for(int mid = l + 1; mid <= r - 1; ++mid) {
fa[l][r] += fa[l][mid] * fa[mid + 1][r];
}
if(fa[l][r] == 2) ans++;
BIN
View File
Binary file not shown.