QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#154315 | #7120. Soccer | skip2004# | 0 | 16ms | 38584kb | C++17 | 1.9kb | 2023-08-31 16:31:13 | 2024-04-28 06:32:08 |
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) {
clear(N);
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 + 1][y], dp[x][y]);
if(x == y) ans = std::max(ans, dp[x][y]);
}
}
}
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
详细
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 6
Accepted
time: 0ms
memory: 35704kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 1
result:
ok ok
Test #2:
score: 6
Accepted
time: 3ms
memory: 36096kb
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: 16ms
memory: 38584kb
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: 0ms
memory: 35268kb
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: 0ms
memory: 35744kb
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: 35328kb
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: 35916kb
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: 3ms
memory: 35892kb
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: 3ms
memory: 35372kb
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%