QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637067#2921. Land Equalityenze114514#WA 0ms3704kbC++20854b2024-10-13 07:37:442024-10-13 07:37:45

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 07:37:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2024-10-13 07:37:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 25;

int n, m, zero, one, two;
int a[75 * 75];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i * m + j];
            if (a[i * m + j] == 0) ++zero;
            if (a[i * m + j] == 1) ++one;
            if (a[i * m + j] == 2) ++two;
        }
    }

    if (zero >= 2) {
        cout << "0\n";
        return 0;
    }

    if (zero == 1) {
        if (a[0] == 1 || a[n * m - 1] == 1 || min(n, m) > 2) cout << "1\n";
        else cout << "2\n";
        return 0;
    }

    if (two % 2 == 1) {
        int k = two / 2;
        cout << (1ull << k) << '\n';
    } else {
        cout << "0\n";
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

5 5
2 2 2 2 2
2 2 1 2 2
2 1 1 1 2
2 2 1 2 2
2 2 2 2 2

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

5 5
2 2 2 2 2
2 2 1 2 2
2 1 1 1 2
2 2 1 1 2
2 2 2 2 2

output:

512

result:

ok single line: '512'

Test #8:

score: -100
Wrong Answer
time: 0ms
memory: 3704kb

input:

2 3
0 1 2
1 1 2

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'