Submission #1070240

#TimeUsernameProblemLanguageResultExecution timeMemory
1070240MohamedFaresNebiliSoccer Stadium (IOI23_soccer)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "soccer.h" using namespace std; int solveA(int r, int i, int j, int N, vector<vector<int>> F) { if(r == N) return 0; int best = 0; for(int l = i; l <= j; l++) { int k = l; if(F[r][l] == 1) continue; while(k <= j && F[r][k] == 0) k++; best = max(best, k - l + solveA(r + 1, l, k - 1, N, F)); l = k - 1; } return best; } int solveB(int r, int i, int j, int N, vector<vector<int>> F) { if(r == -1) return 0; int best = 0; for(int l = i; l <= j; l++) { int k = l; if(F[r][l] == 1) continue; while(k <= j && F[r][k] == 0) k++; best = max(best, k - l + solveB(r - 1, l, k - 1, N, F)); l = k - 1; } return best; } int solveC(int r, int i, int j, int N, vector<vector<int>> F) { if(r == N) return 0; int best = 0; for(int l = i; l <= j; l++) { int k = l; if(F[l][r] == 1) continue; while(k <= j && F[k][r] == 0) k++; best = max(best, k - l + solveC(r + 1, l, k - 1, N, F)); l = k - 1; } return best; } int solveD(int r, int i, int j, int N, vector<vector<int>> F) { if(r == -1) return 0; int best = 0; for(int l = i; l <= j; l++) { int k = l; if(F[l][r] == 1) continue; while(k <= j && F[k][r] == 0) k++; best = max(best, k - l + solveD(r - 1, l, k - 1, N, F)); l = k - 1; } return best; } int biggest_stadium(int N, vector<vector<int>> F) { int res = 0; for(int l = 0; l < N; l++) { for(int i = l; i < N; i++) { for(int r = 0; r < N; r++) { int A = solveA(r, l, i, N, F); int B = solveB(r, l, i, N, F); int C = solveC(r, l, i, N, F); int D = solveD(r, l, i, N, F); res = max({A, B, C, D}); } } } return res; }
#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...