QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#154318 | #7120. Soccer | skip2004# | 0 | 12ms | 37340kb | C++17 | 1.9kb | 2023-08-31 16:32:02 | 2024-04-28 06:32:20 |
Judging History
answer
#include "soccer.h"
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <vector>
const int N = 2005;
int up[N][N], down[N][N];
void clear(int x) {
for(int i = 0;i < N;++i)
for(int j = 0;j < N;++j) {
up[i][j] = 0;
down[i][j] = 0;
}
}
int dp[N][N];
int biggest_stadium(int N, std::vector<std::vector<int>> F) {
for(int i = 0;i < N;++i) {
for(int j = 0;j < N;++j) {
if(F[i][j]) {
up[i][j] = 0;
} else {
up[i][j] = 1;
if(i) up[i][j] += up[i - 1][j];
}
}
}
for(int i = N - 1;i >= 0;--i) {
for(int j = 0;j < N;++j) {
if(F[i][j]) {
down[i][j] = 0;
} else {
down[i][j] = 1 + down[i + 1][j];
}
}
}
int ans = 0;
for(int i = 0;i < N;++i) {
std::vector<int> a(up[i], up[i] + N);
std::vector<int> b(down[i], down[i] + N);
auto qry = [&](int l, int r) {
int x = *min_element(a.begin() + l, a.begin() + r + 1);
int y = *min_element(b.begin() + l, b.begin() + r + 1);
return x + y - 1;
};
for(int x = 0;x < N;++x) {
for(int y = x;y < N;++y) {
dp[x][y] = -1e9;
}
for(int y = x;y < N;++y) {
if(!a[y] || !b[y]) break;
dp[x][y] = 0;
}
}
for(int x = 0;x < N;++x) {
for(int y = N - 1;y >= x;--y) {
dp[x][y] += qry(x, y);
dp[x + 1][y] = std::max(dp[x + 1][y], dp[x][y]);
dp[x][y + 1] = std::max(dp[x][y + 1], dp[x][y]);
if(x == y) ans = std::max(ans, dp[x][y]);
}
}
}
clear(N);
return ans;
}
#ifdef zqj
int main() {
freopen("1.in", "r", stdin);
int N;
assert(1 == scanf("%d", &N));
std::vector<std::vector<int>> F(N, std::vector<int>(N));
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
assert(1 == scanf("%d", &F[i][j]));
}
}
fclose(stdin);
int res = biggest_stadium(N, F);
printf("%d\n", res);
fclose(stdout);
return 0;
}
#endif
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 6
Accepted
time: 4ms
memory: 35208kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 1
result:
ok ok
Test #2:
score: 6
Accepted
time: 0ms
memory: 37236kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
ok ok
Test #3:
score: 1.5
Acceptable Answer
time: 12ms
memory: 37340kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 9700
result:
points 0.250 partial
Test #4:
score: 0
Time Limit Exceeded
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
result:
Subtask #2:
score: 0
Wrong Answer
Test #10:
score: 2
Acceptable Answer
time: 2ms
memory: 35220kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 1 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
points 0.250 partial
Test #11:
score: 2
Acceptable Answer
time: 3ms
memory: 35224kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 3
result:
points 0.250 partial
Test #12:
score: 2
Acceptable Answer
time: 0ms
memory: 35996kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
points 0.250 partial
Test #13:
score: 8
Accepted
time: 3ms
memory: 35192kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 1 0 0 1 0 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 4
result:
ok ok
Test #14:
score: 2
Acceptable Answer
time: 0ms
memory: 36396kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 5
result:
points 0.250 partial
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 35192kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 1 0 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 6
result:
wrong answer wrong
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%