이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
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... |