#include <bits/stdc++.h>
using namespace std;
bool limites(int N, int i, int j){
return i>=0&&i<N&&j>=0&&j<N;
}
int biggest_stadium(int N, vector<vector<int>> F){
int empty_cells=0;
pair<int,int>arbol;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(F[i][j]==0){
empty_cells++;
}
}
}
bool si=true;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(F[i][j]==1){
continue;
}
queue<pair<int,int>>cola;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
vector<vector<int>>dist(N,vector<int>(N,-1));
dist[i][j]=0;
cola.push({i,j});
while(!cola.empty()){
int x=cola.front().first;
int y=cola.front().second;
cola.pop();
for(int dir=0;dir<4;dir++){
int posi=x;
int posj=y;
while(limites(N,posi,posj)&&F[posi][posj]==0){
if(dist[posi][posj]==-1){
dist[posi][posj]=dist[x][y]+1;
cola.push({posi,posj});
posi+=dx[dir];
posj+=dy[dir];
}
else{
break;
}
}
}
}
for(int x=0;x<N;x++){
for(int y=0;y<N;y++){
if(F[x][y]==0&&(dist[x][y]>=3||dist[x][y]==-1)){
si=false;
}
}
}
if(!si){
break;
}
}
if(!si){
break;
}
}
if(si){
return empty_cells;
}
else{
return 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Incorrect |
0 ms |
344 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Incorrect |
0 ms |
344 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Incorrect |
0 ms |
344 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Incorrect |
0 ms |
344 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |