Submission #1194667

#TimeUsernameProblemLanguageResultExecution timeMemory
1194667Ak_16Soccer Stadium (IOI23_soccer)C++20
2 / 100
13 ms3724 KiB
#include <iostream> #include <vector> using namespace std; int l[2005]; int r[2005]; int val[205][2005]; int sm[205][2005]; int mn[2005]; int mx[2005]; int chk; int st; int tot; int lo; int hi; int curl; int curr; int biggest_stadium(int n, vector<vector<int>> f){ tot=0; for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ val[i][j] = f[i-1][j-1]; tot += (1-val[i][j]); } } l[0] = 5000; r[0] = 0; l[n+1] = 5000; r[n+1] = 0; chk=1; for(int i=1; i<=n; i++){ sm[i][0] = 0; for(int j=1; j<=n; j++){ sm[i][j] = sm[i][j-1] + val[i][j]; } } for(int i=1; i<=n; i++){ l[i] = n+1; r[i] = 0; for(int j=1; j<=n; j++){ if(val[i][j]==0){ l[i] = min(l[i], j); r[i] = j; } } if(sm[i][r[i]] - sm[i][l[i]-1]!=0){ chk=0; } } st = 0; for(int i=1; i<=n; i++){ if(r[i]-l[i]>r[st] - l[st]){st = i;} } lo = st; hi = st; curl = l[st]; curr = r[st]; for(int i=1; i<n; i++){ int nx = lo-1; if(r[hi+1]-l[hi+1]>r[nx]-l[nx]){nx = hi+1;} if(l[nx]<curl){chk=0;} if(r[nx]>curr){chk=0;} curl = l[nx]; curr = r[nx]; if(nx==lo-1){lo--;} else {hi++;} } return chk * tot; }
#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...