QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#53695#2921. Land Equalityabdelrahman001#WA 2ms3712kbC++1.5kb2022-10-05 19:40:512022-10-05 19:40:53

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-05 19:40:53]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3712kb
  • [2022-10-05 19:40:51]
  • 提交

answer

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 1e4 + 5;
int n, m, a[65][65];
int z, o, t;
int main() {
    ios_base::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][j];
            z += (a[i][j] == 0);
            o += (a[i][j] == 1);
            t += (a[i][j] == 2);
        }
    }
    if(z) {
        if(z >= 2)
            cout << 0;
        else if(o) {
            for(int i = 0;i < n;i++) {
                for(int j = 0;j < m;j++) {
                    if(a[i][j])
                        continue;
                    if(i && a[i - 1][j] == 1)
                        return cout << 1, 0;
                    if(i + 1 < n && a[i + 1][j] == 1)
                        return cout << 1, 0;
                    if(j && a[i][j - 1] == 1)
                        return cout << 1, 0;
                    if(j + 1 < m && a[i][j + 1] == 1)
                        return cout << 1, 0;
                }
            }
            cout << 2;
        } else
            cout << 2;
    } else if(o == n * m) {
        cout << 0;
    } else {
        if(t % 2 == 0)
            cout << 0;
        else
            cout << (1ll << (t / 2));
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3636kb

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3520kb

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3596kb

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3460kb

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: 2ms
memory: 3636kb

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: 0
Accepted
time: 2ms
memory: 3576kb

input:

2 3
0 1 2
1 1 2

output:

1

result:

ok single line: '1'

Test #9:

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

input:

2 6
0 2 2 1 2 2
1 1 1 1 2 2

output:

1

result:

ok single line: '1'

Test #10:

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

input:

4 4
2 2 2 2
2 1 2 2
2 0 2 2
2 2 2 2

output:

1

result:

ok single line: '1'

Test #11:

score: -100
Wrong Answer
time: 2ms
memory: 3588kb

input:

1 3
0 1 2

output:

1

result:

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