# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1076907 | mickey080929 | Soccer Stadium (IOI23_soccer) | C++17 | 4554 ms | 513360 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int dp[510][510][510];
vector<pair<int,int>> ran[510][510];
int biggest_stadium(int N, vector<vector<int>> F) {
for (int i=0; i<N; i++) {
vector<int> cnt(N, 0);
for (int j=i; j<N; j++) {
for (int k=0; k<N; k++) {
if (F[j][k] == 0) {
cnt[k] ++;
}
}
int l = -1;
for (int k=0; k<N; k++) {
if (cnt[k] == j-i+1) {
if (l == -1) l = k;
if (k == N-1 || cnt[k+1] != j-i+1) {
ran[i][j].push_back({l, k});
}
}
else l = -1;
}
}
}
int ans = 0;
for (int i=0; i<N; i++) {
for (int j=0; j<ran[i][i].size(); j++) {
dp[i][i][j] = ran[i][i][j].second - ran[i][i][j].first + 1;
ans = max(ans, dp[i][i][j]);
}
}
for (int d=1; d<=N-1; d++) {
for (int i=0; i<N-d; i++) {
int j = i + d;
int l = 0;
for (int k=0; k<ran[i][j].size(); k++) {
while (ran[i][j-1][l].second < ran[i][j][k].first)
l ++;
dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][l] + ran[i][j][k].second - ran[i][j][k].first + 1);
ans = max(ans, dp[i][j][k]);
}
l = 0;
for (int k=0; k<ran[i][j].size(); k++) {
while (ran[i+1][j][l].second < ran[i][j][k].first)
l ++;
dp[i][j][k] = max(dp[i][j][k], dp[i+1][j][l] + ran[i][j][k].second - ran[i][j][k].first + 1);
ans = max(ans, dp[i][j][k]);
}
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |