编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#101494 #1437. [L3-2] Ice World Wrong Answer 20 344 ms 40224 K C++ / 4.9 K wyhao 2024-03-12 20:41:46
显示原始代码
#include <bits/stdc++.h>
using namespace std;
const int N = 35;
int n;
int a1, a2, b1, b2;
int c1, c2, d1, d2;
int dp[N][N][N][N][3][3];
bool vis[N][N][N][N][3][3];
int tt(int x1, int y1, int x2, int y2) {
    int t1 = x1 + y1 - 2;
    int t2 = 2 * n - x2 - y2;
    return t1 > t2;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
bool cp1(int x1, int y1, int xx, int yy) {
    if (x1 == a1 and y1 == b1 and xx == c1 and yy == d1)
        return true;
    if (x1 == c1 and y1 == d1 and xx == a1 and yy == b1)
        return true;
    return false;
}
bool cp2(int x1, int y1, int xx, int yy) {
    if (x1 == a2 and y1 == b2 and xx == c2 and yy == d2)
        return true;
    if (x1 == c2 and y1 == d2 and xx == a2 and yy == b2)
        return true;
    return false;
}
int chk(int x1, int y1, int x2, int y2, int t1, int t2) {
    // printf("%d %d %d %d %d %d\n",x1,y1,x2,y2,t1,t2);
    int d = abs(x1 - x2) + abs(y1 - y2);
    if (d <= 1) {
        if (t1 == 1)
            return 1;
        if (t2 == 1)
            return -1;
    }
    if (x1 == x2 or y1 == y2) {
        if (t1 == 2)
            return 1;
        if (t2 == 2)
            return -1;
    }
    return 0;
}
int f(int x1, int y1, int x2, int y2, int t1, int t2) {
    if (vis[x1][y1][x2][y2][t1][t2])
        return dp[x1][y1][x2][y2][t1][t2];
    // printf("%d %d %d %d %d %d\n",x1,y1,x2,y2,t1,t2);
    vis[x1][y1][x2][y2][t1][t2] = true;
    if (x1 == n and y1 == n and x2 == 1 and y2 == 1) {
        dp[x1][y1][x2][y2][t1][t2] = 0;
        return 0;
    }
    int t = tt(x1, y1, x2, y2), d, ansk;
    if (t == 0) {
        ansk = -1;
        for (int k = 0, xx, yy, tt; k < 2; k++) {
            xx = x1 + dx[k];
            yy = y1 + dy[k];
            if (xx < 1 or xx > n or yy < 1 or yy > n)
                continue;
            if (!t1 and t2 != 1) {
                if (cp1(x1, y1, xx, yy)) {
                    d = chk(xx, yy, x2, y2, 1, t2);
                    if (d == 1) {
                        dp[x1][y1][x2][y2][t1][t2] = 1;
                        return 1;
                    }
                    d = f(xx, yy, x2, y2, 1, t2);
                    if (d == 1) {
                        dp[x1][y1][x2][y2][t1][t2] = 1;
                        return 1;
                    }
                    ansk = max(ansk, d);
                }
            }
            if (!t1 and t2 != 2) {
                if (cp2(x1, y1, xx, yy)) {
                    d = chk(xx, yy, x2, y2, 2, t2);
                    if (d == 1) {
                        dp[x1][y1][x2][y2][t1][t2] = 1;
                        return 1;
                    }
                    d = f(xx, yy, x2, y2, 2, t2);
                    if (d == 1) {
                        dp[x1][y1][x2][y2][t1][t2] = 1;
                        return 1;
                    }
                    ansk = max(ansk, d);
                }
            }
            d = chk(xx, yy, x2, y2, t1, t2);
            if (d == 1) {
                dp[x1][y1][x2][y2][t1][t2] = 1;
                return 1;
            }
            d = f(xx, yy, x2, y2, t1, t2);
            if (d == 1) {
                dp[x1][y1][x2][y2][t1][t2] = 1;
                return 1;
            }
            ansk = max(ansk, d);
        }
        dp[x1][y1][x2][y2][t1][t2] = ansk;
        return ansk;
    } else {
        ansk = 1;
        for (int k = 2, xx, yy, tt; k < 4; k++) {
            xx = x2 + dx[k];
            yy = y2 + dy[k];
            if (xx < 1 or xx > n or yy < 1 or yy > n)
                continue;
            if (!t2 and t1 != 1) {
                if (cp1(x2, y2, xx, yy)) {
                    d = chk(x1, y1, xx, yy, t1, 1);
                    if (d == -1) {
                        dp[x1][y1][x2][y2][t1][t2] = -1;
                        return -1;
                    }
                    d = f(x1, y1, xx, yy, t1, 1);
                    if (d == -1) {
                        dp[x1][y1][x2][y2][t1][t2] = -1;
                        return -1;
                    }
                    ansk = min(ansk, d);
                }
            }
            if (!t2 and t1 != 2) {
                if (cp2(x2, y2, xx, yy)) {
                    d = chk(x1, y1, xx, yy, t1, 2);
                    if (d == -1) {
                        dp[x1][y1][x2][y2][t1][t2] = -1;
                        return -1;
                    }
                    d = f(x1, y1, xx, yy, t1, 2);
                    if (d == -1) {
                        dp[x1][y1][x2][y2][t1][t2] = -1;
                        return -1;
                    }
                    ansk = min(ansk, d);
                }
            }
            d = chk(x1, y1, xx, yy, t1, t2);
            if (d == -1) {
                dp[x1][y1][x2][y2][t1][t2] = -1;
                return -1;
            }
            d = f(x1, y1, xx, yy, t1, t2);
            if (d == -1) {
                dp[x1][y1][x2][y2][t1][t2] = -1;
                return -1;
            }
            ansk = min(ansk, d);
        }
        dp[x1][y1][x2][y2][t1][t2] = ansk;
        return ansk;
    }
}
int main() {
    int tests;
    scanf("%d", &tests);
    while (tests--) {
        scanf("%d", &n);
        scanf("%d%d%d%d", &a1, &b1, &c1, &d1);
        scanf("%d%d%d%d", &a2, &b2, &c2, &d2);
        memset(vis, 0, sizeof vis);
        int d = f(1, 1, n, n, 0, 0);
        if (d == 1)
            puts("Alice");
        else if (d == -1)
            puts("Bob");
        else
            puts("0");
    }
    return 0;
}
子任务 #1
Wrong Answer
得分:20
测试点 #1
Wrong Answer
得分:0
用时:21 ms
内存:13544 KiB

输入文件(1.in

20
2 2 1 2 2 1 1 1 2
2 1 1 2 1 1 1 1 2
2 2 1 2 2 2 1 2 2
2 1 2 2 2 2 1 2 2
2 1 1 1 2 1 1 1 2
2 1 1 2
<262 bytes omitted>

答案文件(1.out

Alice
Alice
Bob
Bob
Alice
Alice
Alice
Alice
Bob
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alic
<14 bytes omitted>

用户输出

Alice
Alice
0
Bob
Alice
Alice
Alice
Alice
Bob
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice
Alice

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:24 ms
内存:13816 KiB

输入文件(2.in

20
5 5 3 5 4 2 4 3 4
5 2 3 3 3 2 2 2 3
4 2 1 2 2 3 4 4 4
6 1 2 1 3 1 2 2 2
6 5 1 5 2 6 5 6 6
4 4 3 4
<262 bytes omitted>

答案文件(2.out

Bob
Alice
Bob
Alice
Bob
Bob
Alice
Bob
Alice
Alice
Bob
Alice
Bob
Bob
Alice
Alice
Bob
Bob
Alice
Alice

用户输出

Bob
Alice
Bob
Alice
Bob
0
Alice
0
Alice
0
Bob
Alice
Bob
0
Alice
0
Bob
Bob
0
Alice

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #3
Wrong Answer
得分:0
用时:28 ms
内存:13824 KiB

输入文件(3.in

20
3 1 3 2 3 1 2 1 3
6 6 2 6 3 5 4 5 5
4 4 2 4 3 1 2 2 2
3 1 3 2 3 2 2 3 2
3 2 2 3 2 1 3 2 3
5 4 1 5
<262 bytes omitted>

答案文件(3.out

Alice
Bob
Alice
0
Bob
Bob
Alice
Alice
Alice
Alice
Alice
Bob
Alice
Alice
0
Alice
Bob
Bob
Alice
Bob

用户输出

0
Bob
0
0
0
Bob
Alice
Alice
Alice
0
Alice
Bob
Alice
Alice
0
Alice
Bob
Bob
Alice
Bob

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #4
Wrong Answer
得分:0
用时:22 ms
内存:13892 KiB

输入文件(4.in

20
5 4 3 4 4 2 3 2 4
4 3 4 4 4 3 4 4 4
3 2 1 2 2 2 3 3 3
4 1 4 2 4 1 1 1 2
4 1 1 1 2 4 1 4 2
6 3 4 3
<262 bytes omitted>

答案文件(4.out

Alice
Bob
Bob
Alice
Alice
Alice
Bob
Bob
Alice
Alice
Bob
Bob
Alice
Alice
Bob
Alice
Alice
Alice
Bob
Bo
<2 bytes omitted>

用户输出

0
Bob
Bob
Alice
Alice
Alice
0
Bob
Alice
Alice
Bob
Bob
Alice
Alice
Bob
Alice
Alice
Alice
0
0

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #5
Wrong Answer
得分:0
用时:25 ms
内存:13824 KiB

输入文件(5.in

20
3 2 2 3 2 1 1 1 2
6 5 5 5 6 1 5 2 5
3 2 3 3 3 2 1 3 1
5 1 3 1 4 2 3 2 4
5 2 3 3 3 2 5 3 5
4 1 2 1
<262 bytes omitted>

答案文件(5.out

Alice
Bob
Bob
Alice
Bob
Alice
Alice
Bob
Bob
Alice
Bob
Alice
Alice
Bob
Bob
0
Alice
Alice
Bob
Alice

用户输出

Alice
0
0
Alice
Bob
0
Alice
0
0
0
0
Alice
Alice
0
Bob
0
0
Alice
Bob
Alice

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:22 ms
内存:14720 KiB

输入文件(6.in

20
9 4 2 4 3 4 7 5 7
9 3 7 4 7 4 4 5 4
10 2 9 3 9 9 8 10 8
9 4 1 5 1 7 7 7 8
9 8 7 9 7 4 1 5 1
10 7 
<276 bytes omitted>

答案文件(6.out

Bob
Alice
Bob
Bob
Alice
Bob
Alice
Bob
Alice
Alice
Alice
Bob
Bob
Bob
0
0
Alice
Alice
Alice
Bob

用户输出

Bob
Alice
Bob
Bob
Alice
Bob
Alice
Bob
Alice
Alice
Alice
Bob
Bob
Bob
0
0
Alice
Alice
Alice
Bob

系统信息

Exited with return code 0
测试点 #7
Wrong Answer
得分:0
用时:24 ms
内存:14664 KiB

输入文件(7.in

20
10 4 2 5 2 8 1 8 2
9 9 3 9 4 6 3 7 3
10 4 6 5 6 3 4 3 5
9 7 9 8 9 1 6 2 6
9 7 7 7 8 6 8 7 8
9 4 3
<274 bytes omitted>

答案文件(7.out

Alice
Bob
Alice
0
Bob
Bob
Bob
Alice
Alice
Alice
Bob
Bob
Bob
Alice
Alice
Alice
Bob
Alice
Alice
Alice

用户输出

Alice
0
Alice
0
Bob
Bob
Bob
Alice
0
Alice
Bob
Bob
Bob
Alice
Alice
Alice
0
Alice
Alice
0

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:59 ms
内存:37504 KiB

输入文件(8.in

20
12 11 6 11 7 4 7 5 7
10 3 7 4 7 7 1 8 1
18 9 16 10 16 12 10 12 11
22 12 13 13 13 4 9 5 9
5 4 2 4 
<344 bytes omitted>

答案文件(8.out

Alice
Alice
Bob
Alice
Bob
Alice
Bob
Bob
Bob
Bob
Alice
Alice
Alice
Bob
Bob
Alice
Bob
Alice
Bob
Alice

用户输出

Alice
Alice
Bob
Alice
Bob
Alice
Bob
Bob
Bob
Bob
Alice
Alice
Alice
Bob
Bob
Alice
Bob
Alice
Bob
Alice

系统信息

Exited with return code 0
测试点 #9
Wrong Answer
得分:0
用时:44 ms
内存:40224 KiB

输入文件(9.in

20
5 3 2 4 2 4 2 4 3
6 5 3 5 4 3 2 4 2
5 4 5 5 5 4 1 5 1
8 5 6 5 7 7 5 7 6
21 3 4 3 5 18 21 19 21
15
<339 bytes omitted>

答案文件(9.out

Alice
0
Bob
Bob
Bob
Alice
Bob
Bob
Alice
Alice
Alice
Alice
Alice
Bob
Bob
Bob
Bob
Bob
Alice
Alice

用户输出

Alice
0
0
Bob
Bob
Alice
Bob
Bob
Alice
Alice
Alice
0
Alice
Bob
0
Bob
Bob
Bob
Alice
Alice

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #10
Wrong Answer
得分:0
用时:75 ms
内存:38276 KiB

输入文件(10.in

20
30 16 8 16 9 9 24 9 25
30 6 6 7 6 15 23 16 23
30 28 23 28 24 8 12 9 12
30 22 24 23 24 28 28 29 28
<399 bytes omitted>

答案文件(10.out

Bob
Bob
0
Bob
Alice
Bob
Bob
Alice
Bob
Bob
Bob
Alice
Alice
Bob
Alice
Bob
Bob
Alice
Alice
Bob

用户输出

Bob
Bob
0
Bob
Alice
Bob
Bob
Alice
Bob
Bob
Bob
0
Alice
Bob
Alice
Bob
Bob
Alice
Alice
Bob

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0