#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N,vector<vector<int>> F){
vector<vector<vector<vector<vector<vector<int>>>>>> DP(N,vector<vector<vector<vector<vector<int>>>>>(N,vector<vector<vector<vector<int>>>>(N,vector<vector<vector<int>>>(N,vector<vector<int>>(N,vector<int>(N))))));
for(int row1=N-1;row1>=0;row1--){
for(int row2=row1;row2<N;row2++){
for(int col1=0;col1<N;col1++){
for(int col2=col1;col2<N;col2++){
if(F[row1][col2])break;
for(int col3=0;col3<N;col3++){
for(int col4=col3;col4<N;col4++){
if(F[row2][col4])break;
if(!(col3<=col1 and col2<=col4) and !(col1<=col3 and col4<=col2))continue;
if(row1==row2) {
DP[row1][row2][col1][col2][col3][col4]=max(col2,col4)-min(col1,col3)+1;
continue;
}
if(row1+1==row2) {
DP[row1][row2][col1][col2][col3][col4]=col2+col4-col1-col3+2;
continue;
}
if(col2-col1<=col4-col3) for(int col5=0;col5<=col1;col5++) {
for(int col6=col2;col6<N;col6++) {
DP[row1][row2][col1][col2][col3][col4]=max(DP[row1][row2][col1][col2][col3][col4],DP[row1+1][row2][col5][col6][col3][col4]+col2-col1+1);
}
}
else for(int col5=0;col5<=col3;col5++) {
for(int col6=col4;col6<N;col6++) {
DP[row1][row2][col1][col2][col3][col4]=max(DP[row1][row2][col1][col2][col3][col4],DP[row1][row2-1][col1][col2][col5][col6]+col4-col3+1);
}
}
}
}
}
}
}
}
int ans = 0;
for(auto&i:DP) {
for(auto&j:i) {
for(auto&k:j) {
for(auto&l:k) {
for(auto&h:l) {
for(auto&o:h) {
ans = max(ans,o);
}
}
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
6 ms |
5208 KB |
ok |
4 |
Correct |
10 ms |
8540 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Runtime error |
896 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
440 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
436 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
440 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
436 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
1 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
2 ms |
1884 KB |
ok |
16 |
Correct |
2 ms |
1716 KB |
ok |
17 |
Correct |
2 ms |
1884 KB |
ok |
18 |
Correct |
2 ms |
1884 KB |
ok |
19 |
Correct |
2 ms |
1880 KB |
ok |
20 |
Correct |
2 ms |
1720 KB |
ok |
21 |
Correct |
2 ms |
1884 KB |
ok |
22 |
Correct |
2 ms |
1884 KB |
ok |
23 |
Correct |
2 ms |
1884 KB |
ok |
24 |
Correct |
2 ms |
1884 KB |
ok |
25 |
Correct |
2 ms |
1884 KB |
ok |
26 |
Correct |
2 ms |
1884 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
6 ms |
5208 KB |
ok |
5 |
Correct |
10 ms |
8540 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
440 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
436 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Correct |
2 ms |
1884 KB |
ok |
18 |
Correct |
2 ms |
1716 KB |
ok |
19 |
Correct |
2 ms |
1884 KB |
ok |
20 |
Correct |
2 ms |
1884 KB |
ok |
21 |
Correct |
2 ms |
1880 KB |
ok |
22 |
Correct |
2 ms |
1720 KB |
ok |
23 |
Correct |
2 ms |
1884 KB |
ok |
24 |
Correct |
2 ms |
1884 KB |
ok |
25 |
Correct |
2 ms |
1884 KB |
ok |
26 |
Correct |
2 ms |
1884 KB |
ok |
27 |
Correct |
2 ms |
1884 KB |
ok |
28 |
Correct |
2 ms |
1884 KB |
ok |
29 |
Correct |
2 ms |
1884 KB |
ok |
30 |
Runtime error |
1061 ms |
2097152 KB |
Execution killed with signal 9 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
6 ms |
5208 KB |
ok |
5 |
Correct |
10 ms |
8540 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
440 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
436 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
348 KB |
ok |
17 |
Correct |
2 ms |
1884 KB |
ok |
18 |
Correct |
2 ms |
1716 KB |
ok |
19 |
Correct |
2 ms |
1884 KB |
ok |
20 |
Correct |
2 ms |
1884 KB |
ok |
21 |
Correct |
2 ms |
1880 KB |
ok |
22 |
Correct |
2 ms |
1720 KB |
ok |
23 |
Correct |
2 ms |
1884 KB |
ok |
24 |
Correct |
2 ms |
1884 KB |
ok |
25 |
Correct |
2 ms |
1884 KB |
ok |
26 |
Correct |
2 ms |
1884 KB |
ok |
27 |
Correct |
2 ms |
1884 KB |
ok |
28 |
Correct |
2 ms |
1884 KB |
ok |
29 |
Correct |
2 ms |
1884 KB |
ok |
30 |
Runtime error |
1061 ms |
2097152 KB |
Execution killed with signal 9 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
6 ms |
5208 KB |
ok |
5 |
Correct |
10 ms |
8540 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Runtime error |
896 ms |
2097152 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |