#include "soccer.h"
#include "bits/stdc++.h"
using namespace std;
struct dsu {
vector<int> p, size;
void init(int n) {
p.assign(n + 1, 0);
size.assign(n + 1, 1);
for (int i = 1; i <= n; i++) p[i] = i;
}
int get(int a) {
return (p[a] == a ? a : p[a] = get(p[a]));
}
void add(int a, int b) {
a = get(a);
b = get(b);
if (a == b) return;
if (size[a] > size[b]) swap(a, b);
size[b] += size[a];
p[a] = b;
}
};
int biggest_stadium(int n, std::vector<std::vector<int>> a) {
pair<int, int> tr = make_pair(-1, -1);
for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
if (a[i][j]) tr = make_pair(i, j);
}
if (tr.first == -1) return n * n;
auto [x, y] = tr;
int ans = max(x, n - x - 1) * n + max(y, n - y - 1);
ans = max(ans, max(y, n - y - 1) * n + max(x, n - x - 1));
ans = max(ans, n * n - min(x + 1, n - x) * min(y + 1, n - y));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |