Submission #1078028

#TimeUsernameProblemLanguageResultExecution timeMemory
1078028idasSoccer Stadium (IOI23_soccer)C++17
1.50 / 100
336 ms71136 KiB
#include "bits/stdc++.h" #include "soccer.h" #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define pb push_back using namespace std; typedef vector<int> vi; const int N=2e3+10; int n, f[N][N], par[N][N]; bool ai[N][N], bi[N][N], aj[N][N], bj[N][N]; int biggest_stadium(int N, std::vector<std::vector<int>> F) { n=N; FOR(i, 0, n) FOR(j, 0, n) f[i][j]=F[i][j]; FOR(i, 0, n) { FOR(j, 0, n) { if(j==0) { if(f[i][j]) aj[i][j]=true; continue; } aj[i][j]=aj[i][j-1]&f[i][j]; } for(int j=n-1; j>=0; j--) { if(j==n-1) { if(f[i][j]) bj[i][j]=true; continue; } bj[i][j]=bj[i][j+1]&f[i][j]; } } FOR(j, 0, n) { FOR(i, 0, n) { if(i==0) { if(f[i][j]) ai[i][j]=true; continue; } ai[i][j]=ai[i-1][j]&f[i][j]; } for(int i=n-1; i>=0; i--) { if(i==n-1) { if(f[i][j]) bi[i][j]=true; continue; } bi[i][j]=bi[i+1][j]&f[i][j]; } } int cn=0; FOR(i, 0, n) { FOR(j, 0, n) { if(f[i][j]) { bool ok=false; ok|=ai[i][j]&aj[i][j]; ok|=bi[i][j]&aj[i][j]; ok|=ai[i][j]&bj[i][j]; ok|=bi[i][j]&bj[i][j]; if(!ok) return 0; } else cn++; } } return cn; } /* 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...