#include <bits/stdc++.h>
#include "soccer.h"
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define en '\n'
#define sp ' '
#define tb '\t'
#define ri(n) int n; cin >> n
#define rl(n) ll n; cin >> n
#define rs(s) string s; cin >> s
#define rc(c) char c; cin >> c
#define rv(v) for (auto &x : v) cin >> x
#define pven(v) for (auto x : v) cout << x << en
#define pv(v) for (auto x : v) cout << x << sp; cout << en
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout << "YES" << en
#define no cout << "NO" << en
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define ssort(a, b) if (a < b) swap(a, b)
#define bitcnt(a) (__builtin_popcountll(a))
#define bithigh(a) (63-__builtin_clzll(a))
#define lg bithigh
#define highpow(a) (1LL << (ll)lg(a))
using namespace std;
const ll LINF = 2e18;
const int mxN = 2e3+10, INF = 2e9;
int n, a[mxN][mxN], preX[mxN][mxN], preY[mxN][mxN];
int SumRow(int i, int l, int r){
if (l>r) swap(l, r);
return preX[i][r] - preX[i][l-1];
}
int SumCol(int j, int l, int r){
if (l>r) swap(l, r);
return preY[r][j] - preY[l-1][j];
}
int Check(int x1, int y1, int x2, int y2){
if (!SumRow(x1, y1, y2) && !SumCol(y2, x1, x2))
return 1;
if (!SumCol(y1, x1, x2) && !SumRow(x2, y1, y2))
return 1;
return 0;
}
bool Check(){
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
preX[i][j] = preY[i][j] = a[i][j];
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
preX[i][j] += preX[i][j-1];
preY[i][j] += preY[i-1][j];
}
}
for (int i = 0; i <= n+1; i++)
a[0][i] = a[i][0] = a[n+1][i] = a[i][n+1] = 1;
vector<array<int, 2> > v;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (!a[i][j])
v.pb({i, j});
for (auto [x1, y1] : v)
for (auto [x2, y2] : v)
if (!Check(x1, y1, x2, y2))
return 0;
return 1;
}
int biggest_stadium(int N, vector<vector<int>> F){
n = N;
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
a[i+1][j+1] = F[i][j];
if (!Check()) return 0;
int cnt = 0;
for (int i = 1; i <= N; i++)
cnt += preX[i][N];
return cnt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4444 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Incorrect |
1 ms |
4444 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Incorrect |
1 ms |
4444 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Incorrect |
1 ms |
4444 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Incorrect |
1 ms |
4444 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |