제출 #1233397

#제출 시각아이디문제언어결과실행 시간메모리
1233397antonn축구 경기장 (IOI23_soccer)C++20
18 / 100
50 ms3908 KiB
#include "soccer.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 30 + 7; int a[N][N], pref[N][N], dp[N][N][N][N]; bool ok(int l, int x, int y) { return pref[l][y] - pref[l][x - 1] == 0; } int biggest_stadium(int n, vector<vector<int>> f) { for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { a[i][j] = f[i - 1][j - 1]; pref[i][j] = pref[i][j - 1] + a[i][j]; } } for (int i = 1; i <= n; ++i) { for (int l = 1; l <= n; ++l) { for (int r = l; r <= n; ++r) { dp[i][i][l][r] = -1e9; if (ok(i, l, r)) dp[i][i][l][r] = r - l + 1; } } } for (int h = n; h >= 1; --h) { for (int l = 1; l + h - 1 <= n; ++l) { int r = l + h - 1; for (int h2 = 1; h2 <= n; ++h2) { for (int down = 1; down + h2 - 1 <= n; ++down) { int up = down + h2 - 1; for (int x = l; x <= r; ++x) { for (int y = x; y <= r; ++y) { if (ok(down - 1, x, y)) { dp[down - 1][up][x][y] = max(dp[down - 1][up][x][y], dp[down][up][l][r] + y - x + 1); } if (ok(up + 1, x, y)) { dp[down][up + 1][x][y] = max(dp[down][up + 1][x][y], dp[down][up][l][r] + y - x + 1); } } } } } } } int ans = 0; for (int down = 1; down <= n; ++down) { for (int up = down; up <= n; ++up) { for (int l = 1; l <= n; ++l) { for (int r = l; r <= n; ++r) { ans = max(ans, dp[down][up][l][r]); } } } } 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...