#include<bits/stdc++.h>
#include "soccer.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int n;
vector<vector<int>>f;
int solve(int x,int y){
int lx=x,rx=x,ly=y,ry=y;
while(lx>0&&f[lx-1][y]==0){
lx--;
}
while(rx<n-1&&f[rx+1][y]==0){
rx++;
}
while(ly>0&&f[x][ly-1]==0){
ly--;
}
while(ry<n-1&&f[x][ry+1]==0){
ry++;
}
int left=ly,right=ry;
int total=rx-lx+ry-ly+1;
for(int i=x-1;i>=lx;i--){
int j=y;
while(j>left&&f[i][j-1]==0){
j--;
}
total+=y-j;
left=j;
j=y;
while(j>right&&f[i][j+1]==0){
j++;
}
total+=j-y;
right=j;
}
left=ly,right=ry;
for(int i=x+1;i<=rx;i++){
int j=y;
while(j>left&&f[i][j-1]==0){
j--;
}
total+=y-j;
left=j;
j=y;
while(j>right&&f[i][j+1]==0){
j++;
}
total+=j-y;
right=j;
}
return total;
}
int biggest_stadium(int N,vector<vector<int>>F){
n=N;
f=F;
int ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(f[i][j]==0){
ans=max(ans,solve(i,j));
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |