QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#163888 | #7120. Soccer | zhouhuanyi | 0 | 2ms | 14068kb | C++14 | 1.3kb | 2023-09-04 16:08:26 | 2024-04-28 07:05:10 |
Judging History
answer
#include"soccer.h"
#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 3000
using namespace std;
const int inf=(int)(1e9);
int n,ans,R[N+1][N+1],dp[N+1][N+1],ls[N+1],rs[N+1],fa[N+1][N+1],l[N+1][N+1],r[N+1][N+1],dque[N+1],top;
bool used[N+1][N+1];
int calc(int x,int y)
{
if (R[x][y]==y-1) return -inf;
if (used[x][y]) return dp[x][y];
int res=0;
if (x+1<=n) res=max(res,calc(x+1,y)+r[x][y]-l[x][y]+1);
if (fa[x][y]) res=max(res,calc(x,fa[x][y]));
used[x][y]=1,dp[x][y]=res;
return res;
}
int biggest_stadium(int SN,vector<vector<int>>F)
{
n=SN;
for (int i=1;i<=n;++i) R[i][n+1]=n;
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
{
if (!F[i-1][j-1]) R[i][j]=R[i][j+1];
else R[i][j]=j-1;
}
for (int i=1;i<=n;++i)
{
top=0;
for (int j=1;j<=n;++j) ls[j]=rs[j]=0;
for (int j=1;j<=n;++j)
{
while (top&&R[i][dque[top]]>=R[i][j]) ls[j]=dque[top],top--;
if (top) rs[dque[top]]=j;
l[i][j]=dque[top]+1,dque[++top]=j;
}
for (int j=n;j>=1;--j)
{
if (ls[j]) fa[i][ls[j]]=j;
if (rs[j]) fa[i][rs[j]]=j;
if (rs[j]) r[i][j]=r[i][rs[j]];
else r[i][j]=j;
}
}
for (int i=1;i<=n;++i)
for (int j=1;j<=n;++j)
if (r[i][j]!=j-1)
ans=max(ans,calc(i,j));
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 9996kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 0
result:
wrong answer wrong
Subtask #2:
score: 0
Wrong Answer
Test #10:
score: 2
Acceptable Answer
time: 2ms
memory: 12100kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 0 0 1 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 1
result:
points 0.250 partial
Test #11:
score: 2
Acceptable Answer
time: 2ms
memory: 12308kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 0 0 1 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 0
result:
points 0.250 partial
Test #12:
score: 2
Acceptable Answer
time: 0ms
memory: 12016kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 1 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 3
result:
points 0.250 partial
Test #13:
score: 2
Acceptable Answer
time: 2ms
memory: 14068kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 1 0 0 1 0 1 0 0 1
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 6
result:
points 0.250 partial
Test #14:
score: 8
Accepted
time: 0ms
memory: 12312kb
input:
R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L 3 0 0 1 0 0 0 1 0 0
output:
xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0 OK 6
result:
ok ok
Test #15:
score: 0
Wrong Answer
time: 2ms
memory: 12104kb
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%