#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
const int maxn=2005;
const int inf=1e9;
int f[maxn][maxn],Max[maxn][maxn];
int dp[35][35][35][35];
int cur[35][35][35];
int biggest_stadium(int n, std::vector<std::vector<int>> F)
{
for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) cur[i][j][k]=-inf;
int x=-1,y=-1,cnt=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++) if(F[i][j]==1) x=i,y=j,cnt++;
}
if(cnt==1) return n*n-min(x+1,n-x)*min(y+1,n-y);
if(n<=30){
for(int i=0;i<n;i++){
int l=0;
for(int j=0;j<n;j++){
if(F[i][j]){
for(int s=l;s<j;s++) for(int t=s;t<j;t++) cur[i][s][t]=t-s+1;
l=j+1;
}
}
for(int s=l;s<n;s++) for(int t=s;t<n;t++) cur[i][s][t]=t-s+1;
}
int ans=0;
for(int d=0;d<n;d++){
for(int l=0;l+d<n;l++){
int r=l+d;
for(int i=0;i<n;i++) for(int j=i;j<n;j++){
if(d==0) dp[l][r][i][j]=cur[l][i][j];
else dp[l][r][i][j]=max(dp[l+1][r][i][j]+cur[l][i][j],dp[l][r-1][i][j]+cur[r][i][j]);
dp[l][r][i][j]=max(dp[l][r][i][j],-inf);
ans=max(ans,dp[l][r][i][j]);
}
for(int i=0;i<n;i++) for(int j=i+1;j<n;j++){
dp[l][r][i+1][j]=max(dp[l][r][i+1][j],dp[l][r][i][j]);
dp[l][r][i][j-1]=max(dp[l][r][i][j-1],dp[l][r][i][j]);
}
}
}
return ans;
}
else{
vector<pii> p;
for(int i=0;i<n;i++){
int l=0;
for(int j=0;j<n;j++){
if(F[i][j]){
if(l<j) p.push_back({l,1-j});
l=j+1;
}
}
if(l<n) p.push_back({l,1-n});
}
sort(p.begin(),p.end());
for(int i=1;i<(int)p.size();i++) if(p[i].se<p[i-1].se) return 0;
p.clear();
for(int i=0;i<n;i++){
int l=0;
for(int j=0;j<n;j++){
if(F[j][i]){
if(l<j) p.push_back({l,1-j});
l=j+1;
}
}
if(l<n) p.push_back({l,1-n});
}
sort(p.begin(),p.end());
for(int i=1;i<(int)p.size();i++) if(p[i].se<p[i-1].se) return 0;
}
return n*n-cnt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
340 KB |
ok |
4 |
Correct |
0 ms |
340 KB |
ok |
5 |
Correct |
0 ms |
212 KB |
ok |
6 |
Correct |
0 ms |
212 KB |
ok |
7 |
Correct |
1 ms |
852 KB |
ok |
8 |
Correct |
57 ms |
4628 KB |
ok |
9 |
Correct |
2829 ms |
41564 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Partially correct |
1 ms |
340 KB |
partial |
4 |
Partially correct |
0 ms |
340 KB |
partial |
5 |
Correct |
0 ms |
340 KB |
ok |
6 |
Correct |
0 ms |
340 KB |
ok |
7 |
Correct |
0 ms |
340 KB |
ok |
8 |
Correct |
0 ms |
224 KB |
ok |
9 |
Correct |
0 ms |
340 KB |
ok |
10 |
Correct |
0 ms |
340 KB |
ok |
11 |
Correct |
1 ms |
340 KB |
ok |
12 |
Correct |
0 ms |
340 KB |
ok |
13 |
Correct |
0 ms |
340 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Partially correct |
1 ms |
340 KB |
partial |
5 |
Partially correct |
0 ms |
340 KB |
partial |
6 |
Correct |
0 ms |
340 KB |
ok |
7 |
Correct |
0 ms |
340 KB |
ok |
8 |
Correct |
0 ms |
340 KB |
ok |
9 |
Correct |
0 ms |
224 KB |
ok |
10 |
Correct |
0 ms |
340 KB |
ok |
11 |
Correct |
0 ms |
340 KB |
ok |
12 |
Correct |
1 ms |
340 KB |
ok |
13 |
Correct |
0 ms |
340 KB |
ok |
14 |
Correct |
0 ms |
340 KB |
ok |
15 |
Partially correct |
0 ms |
468 KB |
partial |
16 |
Partially correct |
0 ms |
468 KB |
partial |
17 |
Correct |
1 ms |
340 KB |
ok |
18 |
Correct |
0 ms |
468 KB |
ok |
19 |
Correct |
1 ms |
468 KB |
ok |
20 |
Correct |
0 ms |
468 KB |
ok |
21 |
Correct |
1 ms |
340 KB |
ok |
22 |
Correct |
0 ms |
468 KB |
ok |
23 |
Correct |
0 ms |
468 KB |
ok |
24 |
Partially correct |
0 ms |
468 KB |
partial |
25 |
Correct |
1 ms |
468 KB |
ok |
26 |
Correct |
0 ms |
468 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
340 KB |
ok |
5 |
Correct |
0 ms |
340 KB |
ok |
6 |
Partially correct |
1 ms |
340 KB |
partial |
7 |
Partially correct |
0 ms |
340 KB |
partial |
8 |
Correct |
0 ms |
340 KB |
ok |
9 |
Correct |
0 ms |
340 KB |
ok |
10 |
Correct |
0 ms |
340 KB |
ok |
11 |
Correct |
0 ms |
224 KB |
ok |
12 |
Correct |
0 ms |
340 KB |
ok |
13 |
Correct |
0 ms |
340 KB |
ok |
14 |
Correct |
1 ms |
340 KB |
ok |
15 |
Correct |
0 ms |
340 KB |
ok |
16 |
Correct |
0 ms |
340 KB |
ok |
17 |
Partially correct |
0 ms |
468 KB |
partial |
18 |
Partially correct |
0 ms |
468 KB |
partial |
19 |
Correct |
1 ms |
340 KB |
ok |
20 |
Correct |
0 ms |
468 KB |
ok |
21 |
Correct |
1 ms |
468 KB |
ok |
22 |
Correct |
0 ms |
468 KB |
ok |
23 |
Correct |
1 ms |
340 KB |
ok |
24 |
Correct |
0 ms |
468 KB |
ok |
25 |
Correct |
0 ms |
468 KB |
ok |
26 |
Partially correct |
0 ms |
468 KB |
partial |
27 |
Correct |
1 ms |
468 KB |
ok |
28 |
Correct |
0 ms |
468 KB |
ok |
29 |
Partially correct |
0 ms |
468 KB |
partial |
30 |
Correct |
2 ms |
2772 KB |
ok |
31 |
Correct |
2 ms |
2772 KB |
ok |
32 |
Correct |
2 ms |
2772 KB |
ok |
33 |
Correct |
2 ms |
2772 KB |
ok |
34 |
Incorrect |
2 ms |
2768 KB |
wrong |
35 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
340 KB |
ok |
5 |
Correct |
0 ms |
340 KB |
ok |
6 |
Partially correct |
1 ms |
340 KB |
partial |
7 |
Partially correct |
0 ms |
340 KB |
partial |
8 |
Correct |
0 ms |
340 KB |
ok |
9 |
Correct |
0 ms |
340 KB |
ok |
10 |
Correct |
0 ms |
340 KB |
ok |
11 |
Correct |
0 ms |
224 KB |
ok |
12 |
Correct |
0 ms |
340 KB |
ok |
13 |
Correct |
0 ms |
340 KB |
ok |
14 |
Correct |
1 ms |
340 KB |
ok |
15 |
Correct |
0 ms |
340 KB |
ok |
16 |
Correct |
0 ms |
340 KB |
ok |
17 |
Partially correct |
0 ms |
468 KB |
partial |
18 |
Partially correct |
0 ms |
468 KB |
partial |
19 |
Correct |
1 ms |
340 KB |
ok |
20 |
Correct |
0 ms |
468 KB |
ok |
21 |
Correct |
1 ms |
468 KB |
ok |
22 |
Correct |
0 ms |
468 KB |
ok |
23 |
Correct |
1 ms |
340 KB |
ok |
24 |
Correct |
0 ms |
468 KB |
ok |
25 |
Correct |
0 ms |
468 KB |
ok |
26 |
Partially correct |
0 ms |
468 KB |
partial |
27 |
Correct |
1 ms |
468 KB |
ok |
28 |
Correct |
0 ms |
468 KB |
ok |
29 |
Partially correct |
0 ms |
468 KB |
partial |
30 |
Correct |
2 ms |
2772 KB |
ok |
31 |
Correct |
2 ms |
2772 KB |
ok |
32 |
Correct |
2 ms |
2772 KB |
ok |
33 |
Correct |
2 ms |
2772 KB |
ok |
34 |
Incorrect |
2 ms |
2768 KB |
wrong |
35 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
ok |
2 |
Correct |
1 ms |
212 KB |
ok |
3 |
Correct |
1 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
340 KB |
ok |
5 |
Correct |
0 ms |
340 KB |
ok |
6 |
Correct |
0 ms |
212 KB |
ok |
7 |
Correct |
0 ms |
212 KB |
ok |
8 |
Correct |
1 ms |
852 KB |
ok |
9 |
Correct |
57 ms |
4628 KB |
ok |
10 |
Correct |
2829 ms |
41564 KB |
ok |
11 |
Partially correct |
1 ms |
340 KB |
partial |
12 |
Partially correct |
0 ms |
340 KB |
partial |
13 |
Correct |
0 ms |
340 KB |
ok |
14 |
Correct |
0 ms |
340 KB |
ok |
15 |
Correct |
0 ms |
340 KB |
ok |
16 |
Correct |
0 ms |
224 KB |
ok |
17 |
Correct |
0 ms |
340 KB |
ok |
18 |
Correct |
0 ms |
340 KB |
ok |
19 |
Correct |
1 ms |
340 KB |
ok |
20 |
Correct |
0 ms |
340 KB |
ok |
21 |
Correct |
0 ms |
340 KB |
ok |
22 |
Partially correct |
0 ms |
468 KB |
partial |
23 |
Partially correct |
0 ms |
468 KB |
partial |
24 |
Correct |
1 ms |
340 KB |
ok |
25 |
Correct |
0 ms |
468 KB |
ok |
26 |
Correct |
1 ms |
468 KB |
ok |
27 |
Correct |
0 ms |
468 KB |
ok |
28 |
Correct |
1 ms |
340 KB |
ok |
29 |
Correct |
0 ms |
468 KB |
ok |
30 |
Correct |
0 ms |
468 KB |
ok |
31 |
Partially correct |
0 ms |
468 KB |
partial |
32 |
Correct |
1 ms |
468 KB |
ok |
33 |
Correct |
0 ms |
468 KB |
ok |
34 |
Partially correct |
0 ms |
468 KB |
partial |
35 |
Correct |
2 ms |
2772 KB |
ok |
36 |
Correct |
2 ms |
2772 KB |
ok |
37 |
Correct |
2 ms |
2772 KB |
ok |
38 |
Correct |
2 ms |
2772 KB |
ok |
39 |
Incorrect |
2 ms |
2768 KB |
wrong |
40 |
Halted |
0 ms |
0 KB |
- |