QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96420 | #2921. Land Equality | mariam# | WA | 3ms | 3588kb | C++17 | 2.1kb | 2023-04-13 21:14:17 | 2023-04-13 21:16:24 |
Judging History
answer
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <unordered_set>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <stdio.h>
#include <stack>
#include <list>
#include "complex"
#include <assert.h>
#define el '\n'
#define ll long long
#define ld long double
using namespace std;
//
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//
//using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const int N = 2e5 + 5, mod = 1e9 + 7, MAX = 1e9 + 1, M = 1e5;
long double PI = 3.14159265358979323846;;
#define point complex<long double>
#define vec(a, b) b-a
#define dot(a, b) (long double)(conj(a)*b).real()
#define cross(a, b) (long double)(conj(a)*b).imag()
#define length(a) (hypot((a).imag(), (a).real()))
#define angle(a) atan2((a).imag(), (a).real())
int h, w;
//char a[201][201];
//int dx[] = {0, 0, -1, 1, 1, -1, -1, 1}, dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
//int dx[] = {-1, -1, 0, 0, 1, 1}, dy[] = {-1, 0, -1, 1, 0, 1};
//
//bool valid(int i, int j) {
// return (i < h && i >= 0 && j < w && j >= 0);
//}
//
//bool vis[201][201];
void m() {
int r, c, x;
cin >> r >> c;
int c0 = 0, c2 = 0, c1 = 0;
for (int i = 0; i < r; ++i) {
for (int j = 0; j < c; ++j) {
cin >> x;
if (x == 0)c0++;
else if (x == 2)c2++;
else c1++;
}
}
ll ans = 0;
if (c0 >= 2)
ans = 0;
else if (c0 == 1) {
if (c1)ans = 1;
else if (c2)ans = 2;
} else if (c2 >= 1) {
if (c2 % 2 == 0)
ans = 0;
else
ans = 1ll * (1ll << (c2 / 2));
} else
ans = 0;
cout<<ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin>>t;
while (t--) {
m();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3308kb
input:
1 2 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3440kb
input:
1 2 0 2
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3416kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3328kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
2 1 0 0
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3588kb
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: 3304kb
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: 3368kb
input:
2 3 0 1 2 1 1 2
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3376kb
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: 3368kb
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: 3372kb
input:
1 3 0 1 2
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'