QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96244 | #2921. Land Equality | Abdelrahman_K# | WA | 2ms | 3524kb | C++14 | 1.7kb | 2023-04-13 17:49:54 | 2023-04-13 17:49:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
const int N = 2e7 + 2;
int main() {
// int x, y;
// cin >> x >> y;
// if (x > y) swap(x, y);
// string s;
// cin >> s;
// int a[4] = {};
// for (int i = 0; i < 4; i++) {
// if (s[i] == 'A') {
// if (x)
// a[i] = x, x = 0;
// else
// a[i] = y;
// }
// }
// if (s[0] == 'B')
// a[0] = 1;
// if (s[3] == 'B')
// a[3] = 9;
// if (s[1] == 'B' && s[2] == 'B') {
// if (a[3] - a[0] != 3)
// a[1] = a[2] = -1;
// else
// a[1] = a[0] + 1, a[2] = a[0] + 2;
// }
// else {
// if (s[1] == 'B') {
// if (a[2] - a[0] != 2)
// a[1] = -1;
// else
// a[1] = a[0] + 1;
// }
// if (s[2] == 'B') {
// if (a[3] - a[1] != 2)
// a[2] = -1;
// else
// a[2] = a[0] + 2;
// }
// }
// sort(a,a + 4);
// for (int i = 0; i < 4; i++) {
// if ((i && a[i] - a[i - 1] != 1) || a[0] == -1)
// return cout << -1, 0;
// }
// for (int i = 0; i < 4; i++) {
// if (s[i] == 'B')
// cout << a[i] << ' ';
// }
int n, m;
cin>>n>>m;
int arr[3] = {};
for(int i = 0; i < n * m; i++){
int a; cin>>a;
arr[a]++;
}
if(arr[0] >= 2)
cout<<0;
else if(arr[0] == 1){
if(arr[1] > 0)
cout<<1;
else
cout<<2;
}
else if(arr[2] % 2 == 0){
cout<<0;
}
else
cout<< (1ll << (arr[2] / 2));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3360kb
input:
1 2 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3356kb
input:
1 2 0 2
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3312kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3360kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
2 1 0 0
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3272kb
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: 3372kb
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: 0ms
memory: 3280kb
input:
2 3 0 1 2 1 1 2
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3524kb
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: 3360kb
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: 3444kb
input:
1 3 0 1 2
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'