QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#53674 | #2921. Land Equality | Silverhorse7# | WA | 2ms | 3568kb | C++ | 845b | 2022-10-05 18:33:21 | 2022-10-05 18:33:23 |
Judging History
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'