#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
const int N=550;
int n,psum[N][N],l[N][N],r[N][N],currl[N][N],currr[N][N],dp[N][N],ans;
vector<vector<int>> f;
int get(int _x1,int _y1,int _x2,int _y2){
if (_x1>_x2) swap(_x1,_x2);
if (_y1>_y2) swap(_y1,_y2);
return psum[_x2][_y2]-psum[_x1-1][_y2]-psum[_x2][_y1-1]+psum[_x1-1][_y1+1];
}
int biggest_stadium(int N, vector<vector<int>> F) {
n=N;
f=F;
for (int i=1;i<=n;i++) for (int j=1;j<=n;j++){
psum[i][j]=psum[i-1][j]+psum[i][j-1]+F[i-1][j-1]-psum[i-1][j-1];
}
//l: first block r: last space
for (int i=1;i<=n;i++){
l[i][0]=0;
for (int j=1;j<=n;j++) l[i][j]=(F[i-1][j-1]?j:l[i][j-1]);
r[i][n+1]=n;
for (int j=n;j>=1;j--) r[i][j]=(F[i-1][j-1]?j-1:r[i][j+1]);
}
for (int y=1;y<=n;y++){
for (int i=1;i<=n;i++) currl[i][i]=l[i][y],currr[i][i]=r[i][y];
for (int i=n;i>=1;i--) for (int j=i+1;j<=n;j++){
currl[i][j]=max(currl[i+1][j],currl[i][j-1]);
currr[i][j]=min(currr[i+1][j],currr[i][j-1]);
}
for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) dp[i][j]=0;
for (int i=1;i<=n;i++) dp[i][i]=currr[i][i]-currl[i][i];
for (int i=n;i>=1;i--) for (int j=i+1;j<=n;j++){
dp[i][j]=max(dp[i+1][j],dp[i][j-1]);
dp[i][j]=max(dp[i][j],dp[i+1][j]+currr[i][j]-currl[i][j]);
dp[i][j]=max(dp[i][j],dp[i][j-1]+currr[i][j]-currl[i][j]);
}
ans=max(ans,dp[1][n]);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
6 ms |
5212 KB |
ok |
8 |
Correct |
543 ms |
10200 KB |
ok |
9 |
Runtime error |
314 ms |
98520 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
0 ms |
4452 KB |
ok |
9 |
Correct |
1 ms |
4696 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4440 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
0 ms |
4452 KB |
ok |
10 |
Correct |
1 ms |
4696 KB |
ok |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
1 ms |
4452 KB |
ok |
16 |
Correct |
1 ms |
4456 KB |
ok |
17 |
Correct |
1 ms |
4456 KB |
ok |
18 |
Correct |
1 ms |
4444 KB |
ok |
19 |
Correct |
1 ms |
4444 KB |
ok |
20 |
Correct |
1 ms |
4444 KB |
ok |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4444 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4440 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
0 ms |
4452 KB |
ok |
12 |
Correct |
1 ms |
4696 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
1 ms |
4444 KB |
ok |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Correct |
1 ms |
4452 KB |
ok |
18 |
Correct |
1 ms |
4456 KB |
ok |
19 |
Correct |
1 ms |
4456 KB |
ok |
20 |
Correct |
1 ms |
4444 KB |
ok |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4444 KB |
ok |
27 |
Correct |
1 ms |
4444 KB |
ok |
28 |
Correct |
1 ms |
4444 KB |
ok |
29 |
Correct |
1 ms |
4444 KB |
ok |
30 |
Correct |
1 ms |
4700 KB |
ok |
31 |
Correct |
1 ms |
4700 KB |
ok |
32 |
Correct |
1 ms |
4700 KB |
ok |
33 |
Correct |
1 ms |
4700 KB |
ok |
34 |
Correct |
1 ms |
4700 KB |
ok |
35 |
Correct |
1 ms |
4700 KB |
ok |
36 |
Correct |
1 ms |
4700 KB |
ok |
37 |
Correct |
1 ms |
4952 KB |
ok |
38 |
Correct |
1 ms |
4700 KB |
ok |
39 |
Correct |
1 ms |
4756 KB |
ok |
40 |
Correct |
1 ms |
4700 KB |
ok |
41 |
Correct |
1 ms |
4700 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
1 ms |
4440 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Correct |
0 ms |
4452 KB |
ok |
12 |
Correct |
1 ms |
4696 KB |
ok |
13 |
Correct |
1 ms |
4444 KB |
ok |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Correct |
1 ms |
4444 KB |
ok |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Correct |
1 ms |
4452 KB |
ok |
18 |
Correct |
1 ms |
4456 KB |
ok |
19 |
Correct |
1 ms |
4456 KB |
ok |
20 |
Correct |
1 ms |
4444 KB |
ok |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Correct |
1 ms |
4444 KB |
ok |
25 |
Correct |
1 ms |
4444 KB |
ok |
26 |
Correct |
1 ms |
4444 KB |
ok |
27 |
Correct |
1 ms |
4444 KB |
ok |
28 |
Correct |
1 ms |
4444 KB |
ok |
29 |
Correct |
1 ms |
4444 KB |
ok |
30 |
Correct |
1 ms |
4700 KB |
ok |
31 |
Correct |
1 ms |
4700 KB |
ok |
32 |
Correct |
1 ms |
4700 KB |
ok |
33 |
Correct |
1 ms |
4700 KB |
ok |
34 |
Correct |
1 ms |
4700 KB |
ok |
35 |
Correct |
1 ms |
4700 KB |
ok |
36 |
Correct |
1 ms |
4700 KB |
ok |
37 |
Correct |
1 ms |
4952 KB |
ok |
38 |
Correct |
1 ms |
4700 KB |
ok |
39 |
Correct |
1 ms |
4756 KB |
ok |
40 |
Correct |
1 ms |
4700 KB |
ok |
41 |
Correct |
1 ms |
4700 KB |
ok |
42 |
Correct |
540 ms |
10208 KB |
ok |
43 |
Correct |
546 ms |
10200 KB |
ok |
44 |
Correct |
542 ms |
10204 KB |
ok |
45 |
Correct |
537 ms |
10200 KB |
ok |
46 |
Correct |
541 ms |
10208 KB |
ok |
47 |
Correct |
537 ms |
10076 KB |
ok |
48 |
Correct |
538 ms |
10204 KB |
ok |
49 |
Correct |
535 ms |
10076 KB |
ok |
50 |
Correct |
536 ms |
10072 KB |
ok |
51 |
Correct |
536 ms |
10076 KB |
ok |
52 |
Correct |
534 ms |
10396 KB |
ok |
53 |
Correct |
535 ms |
10200 KB |
ok |
54 |
Correct |
540 ms |
10072 KB |
ok |
55 |
Correct |
541 ms |
10324 KB |
ok |
56 |
Correct |
537 ms |
10196 KB |
ok |
57 |
Correct |
540 ms |
10196 KB |
ok |
58 |
Correct |
535 ms |
10200 KB |
ok |
59 |
Correct |
535 ms |
10076 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Correct |
1 ms |
4444 KB |
ok |
8 |
Correct |
6 ms |
5212 KB |
ok |
9 |
Correct |
543 ms |
10200 KB |
ok |
10 |
Runtime error |
314 ms |
98520 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |