#include <iostream>
#include <algorithm>
using namespace std;
int map[10000][10000], x[10000], y[10000], n, xx, ans;
int Inquire(int x, int y) {
int cnt = 0;
for (int i = 0; i < n; i++) {
if (map[i][y] && i != x) {
cnt++;
}
}
for (int i = 0; i < n; i++) {
if (map[x][i] && i != y) {
cnt++;
}
}
return cnt;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> map[i][j];
if (!map[i][j]) {
x[xx] = i;
y[xx++] = j;
}
}
}
for (int i = 0; i < xx; i++) {
ans = max(Inquire(x[i], y[i]), ans);
}
if (xx == 0) {
cout << "Bad Game!" << endl;
return 0;
}
cout << ans << endl;
return 0;
}
自己的样例都过了