QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#53673 | #2921. Land Equality | abdelrahman001# | WA | 2ms | 3668kb | C++ | 940b | 2022-10-05 18:18:05 | 2022-10-05 18:18:09 |
Judging History
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)
cout << 1;
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: 3532kb
input:
1 2 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
1 2 0 2
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
2 1 0 0
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3584kb
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: 3580kb
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: 3636kb
input:
2 3 0 1 2 1 1 2
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3464kb
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: 2ms
memory: 3460kb
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: 1ms
memory: 3592kb
input:
1 3 0 1 2
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'