QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#53674#2921. Land EqualitySilverhorse7#WA 2ms3568kbC++845b2022-10-05 18:33:212022-10-05 18:33:23

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-05 18:33:23]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3568kb
  • [2022-10-05 18:33:21]
  • Submitted

answer

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define ex(ans) {cout<<(ans);exit(0);}
int a[100][100];

signed main() {
    int n, m;
    cin >> n >> m;
    int c1 = 0, c2 = 0, c0 = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            int x;
            cin >> x;
            c1 += x == 1;
            c2 += x == 2;
            c0 += x == 0;
            a[i][j] = x;
        }
    if (c0 >= 2) ex(0);
    if (c0 == 1) {
        if (c2 == 0) ex(1);
        if (c1 == 0) ex(2);
        if (n == 1 or m == 1) {
            if (a[0][0] == 1 or a[n - 1][m - 1] == 1) ex(1);
            ex(2);
        }
        ex(1);
    }
    if (c1 == 0) {
        if (c2 % 2 == 0) ex(0);
        ex(1ll << (c2 / 2));
    }
    if (c2 == 0) ex(0);
    ex(1ll << (c2 / 2));
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

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

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

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

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

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

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:

1024

result:

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