#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 si_hay_arbol=0;
pair<int,int>arbol;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(F[i][j]==0){
continue;
}
else{
arbol={i,j};
si_hay_arbol++;
}
}
}
if(!si_hay_arbol){
return N*N;
}
else if(si_hay_arbol==1){
int a=((arbol.first+1)*(arbol.second+1))+min((arbol.first+1),(arbol.second+1));
int b=(((arbol.first+1)*(N-arbol.second))+min((arbol.first+1),(N-arbol.second)));
int c=(((N-arbol.first)*(arbol.second+1))+min((N-arbol.first),(arbol.second+1)));
int d=(((N-arbol.first)*(N-arbol.second))+min((N-arbol.first),(N-arbol.second)));
int e=((arbol.first+1)*(arbol.second+1));
int f=(((arbol.first+1)*(N-arbol.second)));
int g=(((N-arbol.first)*(arbol.second+1)));
int h=(((N-arbol.first)*(N-arbol.second)));
int max_rectangle=min(min(a,b),min(c,d));
max_rectangle=min(max_rectangle,min(min(e,f),min(g,h)));
return (N*N)-max_rectangle;
}
else{
int empty_cells=0;
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;
}
priority_queue<tuple<int,int,int>,vector<tuple<int,int,int>>,greater<tuple<int,int,int>>>cola;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
vector<vector<int>>dist(N,vector<int>(N,INT_MAX));
dist[i][j]=0;
cola.push({0,i,j});
while(!cola.empty()){
auto[d,x,y]=cola.top();
cola.pop();
for(int dir=0;dir<4;dir++){
int posi=x+dx[dir];
int posj=y+dy[dir];
while(true){
if(!limites(N,posi,posj)||F[posi][posj]==1)break;
if((d+1)<dist[posi][posj]){
dist[posi][posj]=d+1;
cola.push({dist[posi][posj],posi,posj});
}
posi+=dx[dir];
posj+=dy[dir];
}
}
}
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 |
348 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
512 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
16 ms |
2204 KB |
ok |
9 |
Correct |
194 ms |
31772 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Partially correct |
0 ms |
344 KB |
partial |
4 |
Partially correct |
0 ms |
344 KB |
partial |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1 ms |
348 KB |
partial |
8 |
Correct |
0 ms |
344 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Partially correct |
1 ms |
348 KB |
partial |
12 |
Partially correct |
0 ms |
348 KB |
partial |
13 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Partially correct |
0 ms |
344 KB |
partial |
5 |
Partially correct |
0 ms |
344 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
1 ms |
348 KB |
partial |
9 |
Correct |
0 ms |
344 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Partially correct |
0 ms |
348 KB |
partial |
12 |
Partially correct |
1 ms |
348 KB |
partial |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Partially correct |
0 ms |
348 KB |
partial |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
1 ms |
344 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Correct |
0 ms |
344 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Partially correct |
1 ms |
348 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
1 ms |
344 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
512 KB |
ok |
6 |
Partially correct |
0 ms |
344 KB |
partial |
7 |
Partially correct |
0 ms |
344 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
1 ms |
348 KB |
partial |
11 |
Correct |
0 ms |
344 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Partially correct |
1 ms |
348 KB |
partial |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
1 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
344 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Partially correct |
0 ms |
348 KB |
partial |
28 |
Partially correct |
1 ms |
344 KB |
partial |
29 |
Partially correct |
0 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
1 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
344 KB |
partial |
33 |
Partially correct |
0 ms |
344 KB |
partial |
34 |
Correct |
3 ms |
348 KB |
ok |
35 |
Correct |
12 ms |
448 KB |
ok |
36 |
Partially correct |
1 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
0 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Partially correct |
1 ms |
348 KB |
partial |
41 |
Partially correct |
0 ms |
348 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
512 KB |
ok |
6 |
Partially correct |
0 ms |
344 KB |
partial |
7 |
Partially correct |
0 ms |
344 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
1 ms |
348 KB |
partial |
11 |
Correct |
0 ms |
344 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Partially correct |
1 ms |
348 KB |
partial |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
1 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
344 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Partially correct |
0 ms |
348 KB |
partial |
28 |
Partially correct |
1 ms |
344 KB |
partial |
29 |
Partially correct |
0 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
1 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
344 KB |
partial |
33 |
Partially correct |
0 ms |
344 KB |
partial |
34 |
Correct |
3 ms |
348 KB |
ok |
35 |
Correct |
12 ms |
448 KB |
ok |
36 |
Partially correct |
1 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
0 ms |
348 KB |
partial |
39 |
Partially correct |
0 ms |
348 KB |
partial |
40 |
Partially correct |
1 ms |
348 KB |
partial |
41 |
Partially correct |
0 ms |
348 KB |
partial |
42 |
Partially correct |
71 ms |
3860 KB |
partial |
43 |
Partially correct |
55 ms |
3416 KB |
partial |
44 |
Partially correct |
281 ms |
5072 KB |
partial |
45 |
Partially correct |
448 ms |
7368 KB |
partial |
46 |
Partially correct |
104 ms |
4096 KB |
partial |
47 |
Partially correct |
736 ms |
7636 KB |
partial |
48 |
Execution timed out |
4560 ms |
6416 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
512 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
16 ms |
2204 KB |
ok |
10 |
Correct |
194 ms |
31772 KB |
ok |
11 |
Partially correct |
0 ms |
344 KB |
partial |
12 |
Partially correct |
0 ms |
344 KB |
partial |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Partially correct |
0 ms |
348 KB |
partial |
15 |
Partially correct |
1 ms |
348 KB |
partial |
16 |
Correct |
0 ms |
344 KB |
ok |
17 |
Correct |
0 ms |
348 KB |
ok |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
1 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
348 KB |
partial |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Partially correct |
0 ms |
348 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
1 ms |
344 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Correct |
0 ms |
344 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Partially correct |
1 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
348 KB |
partial |
31 |
Partially correct |
0 ms |
348 KB |
partial |
32 |
Partially correct |
0 ms |
348 KB |
partial |
33 |
Partially correct |
1 ms |
344 KB |
partial |
34 |
Partially correct |
0 ms |
348 KB |
partial |
35 |
Partially correct |
0 ms |
348 KB |
partial |
36 |
Partially correct |
1 ms |
348 KB |
partial |
37 |
Partially correct |
0 ms |
344 KB |
partial |
38 |
Partially correct |
0 ms |
344 KB |
partial |
39 |
Correct |
3 ms |
348 KB |
ok |
40 |
Correct |
12 ms |
448 KB |
ok |
41 |
Partially correct |
1 ms |
348 KB |
partial |
42 |
Partially correct |
1 ms |
348 KB |
partial |
43 |
Partially correct |
0 ms |
348 KB |
partial |
44 |
Partially correct |
0 ms |
348 KB |
partial |
45 |
Partially correct |
1 ms |
348 KB |
partial |
46 |
Partially correct |
0 ms |
348 KB |
partial |
47 |
Partially correct |
71 ms |
3860 KB |
partial |
48 |
Partially correct |
55 ms |
3416 KB |
partial |
49 |
Partially correct |
281 ms |
5072 KB |
partial |
50 |
Partially correct |
448 ms |
7368 KB |
partial |
51 |
Partially correct |
104 ms |
4096 KB |
partial |
52 |
Partially correct |
736 ms |
7636 KB |
partial |
53 |
Execution timed out |
4560 ms |
6416 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |