Submission #1064028

# Submission time Handle Problem Language Result Execution time Memory
1064028 2024-08-18T08:28:50 Z amirhoseinfar1385 Soccer Stadium (IOI23_soccer) C++17
0 / 100
4500 ms 86868 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn=2000+10;
int n,all[maxn][maxn],dpb[maxn][maxn],dpp[maxn][maxn];

void calbal(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(all[i][j]==1){
                dpb[i][j]=0;
            }else{
                dpb[i][j]=dpb[i-1][j]+1;
            }
        }
    }
}

void calpaee(){
    for(int i=n;i>=1;i--){
        for(int j=1;j<=n;j++){
            if(all[i][j]==0){
                dpp[i][j]=dpp[i+1][j]+1;
            }else{
                dpp[i][j]=0;
            }
        }
    }
}

int cal(int r,int c){
    int ret=0;
    int mn1=n,mn2=n;
    for(int i=c;i>=1;i--){
        mn1=min(dpp[r][i],mn1);
        mn2=min(dpb[r][i],mn2);
        ret+=mn1+mn2;
        if(mn1!=0&&mn2!=0){
            ret--;
        }
    }
    mn1=n;
    mn2=n;
    for(int i=c;i<=n;i++){
        mn1=min(dpp[r][i],mn1);
        mn2=min(mn2,dpb[r][i]);
        if(i==c){
            continue;
        }
        ret+=mn1+mn2;
        if(mn1!=0&&mn2!=0){
            ret--;
        }
    }
    return ret;
}

int solve(){
    int ret=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            ret=max(ret,cal(i,j));
        }
    }
    return ret;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    n=N;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            all[i][j]=F[i-1][j-1];
        }
    }
    calbal();
    calpaee();
    return solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 440 KB ok
7 Correct 3 ms 1884 KB ok
8 Correct 174 ms 11860 KB ok
9 Execution timed out 4546 ms 86868 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 440 KB ok
7 Incorrect 0 ms 344 KB wrong
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 440 KB ok
8 Incorrect 0 ms 344 KB wrong
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 440 KB ok
10 Incorrect 0 ms 344 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 440 KB ok
10 Incorrect 0 ms 344 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 440 KB ok
8 Correct 3 ms 1884 KB ok
9 Correct 174 ms 11860 KB ok
10 Execution timed out 4546 ms 86868 KB Time limit exceeded
11 Halted 0 ms 0 KB -