Submission #1064054

#TimeUsernameProblemLanguageResultExecution timeMemory
1064054DorostWefSoccer Stadium (IOI23_soccer)C++17
64 / 100
2524 ms820820 KiB
#include "soccer.h" #include <bits/stdc++.h> using namespace std; const int N = 504, INF = -5000000; vector <int> a[N][N]; int dp[N][N][N]; int biggest_stadium(int N, std::vector<std::vector<int>> F) { int mx = 0; int n = N; for (int l = n - 1; l >= 0; l--) { for (int r = l; r < n; r++) { if (l != r) { a[l][r] = a[l + 1][r]; } for (int j = 0; j < n; j++) { if (F[l][j]) a[l][r].push_back(j); } a[l][r].push_back(-1); a[l][r].push_back(n); sort (a[l][r].begin(), a[l][r].end()); a[l][r].erase (unique (a[l][r].begin(), a[l][r].end()), a[l][r].end()); for (int k = 0; k < (int)a[l][r].size() - 1; k++) { int L = a[l][r][k]; int R = a[l][r][k + 1]; int s = R - L - 1; if (L != -1) { dp[l][r][L] = INF; } for (int w = L + 1; w < R; w++) { int mm = 0; if (l != r) { mm = max (dp[l + 1][r][w], dp[l][r - 1][w]); } dp[l][r][w] = s + mm; //cout << l << ' ' << r << ' ' << L << ' ' << R << endl; mx = max (mx, dp[l][r][w]); } } } } return mx; }
#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...