UOJ Logo

NOI.AC

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#140#196991#3433. CrisscrossGoneendshizipingSuccess!2023-11-14 17:28:392023-11-14 17:28:40

Details

Extra Test:

Wrong Answer
time: 0ms
memory: 1252kb

input:

4 3
011
011
101
101

output:

3

result:

wrong answer 1st numbers differ - expected: '7', found: '3'

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196991#3433. Crisscrossshiziping9726ms2236kbC++11817b2023-11-04 15:55:482023-11-14 17:29:13

answer

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp(Tx, Ty) make_pair(Tx, Ty)
#define For(Ti, Ta, Tb) for(auto Ti = (Ta); Ti <= (Tb); Ti++)
#define Dec(Ti, Ta, Tb) for(auto Ti = (Ta); Ti >= (Tb); Ti--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
const int N = 1005;
char a[N][N];
int n, m;
int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	cin >> n >> m;
	For(i, 1, n) cin >> a[i] + 1;
	long long ans = 1;
	For(i, 1, n) {
		int cnt = 0;
		For(j, 1, m) {
			cnt += (a[i][j] == '0');
		}
		if (cnt == 0) continue;
		if (cnt == 1) continue;
		ans++;
	}
	For(j, 1, m) {
		int cnt = 0;
		For(i, 1, n) {	
			cnt += (a[i][j] == '0');
		}
		if (cnt == 0) continue;
		ans++;
	}
	cout << ans;
	return 0;
}