Submission #1011867

#TimeUsernameProblemLanguageResultExecution timeMemory
1011867mdn2002Soccer Stadium (IOI23_soccer)C++17
0 / 100
0 ms348 KiB
#include "soccer.h" #include<bits/stdc++.h> using namespace std; int biggest_stadium(int N, vector<vector<int>> F) { int n = N; vector<vector<int>> a = F, next(n, vector<int>(n)); function<int(int, int, int, int)> f = [&] (int l, int r, int x, int y) { int ans = 0; if (x - 1 >= 0) { for (int j = l; j <= r; j ++) { ans = max(ans, f(j, next[x - 1][j], x - 1, y) + next[x - 1][j] - j + 1); } } if (y + 1 < n - 1) { for (int j = l; j <= r; j ++) { ans = max(ans, f(j, next[y + 1][j], x, y + 1) + next[y + 1][j] - j + 1); } } return ans; }; for (int i = 0; i < n; i ++) { if (a[i][n - 1] == 0) next[i][n - 1] = n - 1; else next[i][n - 1] = n - 2; for (int j = n - 2; j >= 0; j --) { if (a[i][j]) next[i][j] = j - 1; else next[i][j] = next[i][j + 1]; } } int ans = 0; for (int i = 0; i < n; i ++) { for (int j = 0; j < n; j ++) { if (a[i][j]) continue; ans = max(ans, f(j, next[i][j], i, i) + next[i][j] - j + 1); } } return ans; }
#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...