QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#155045#7120. SoccerLynkcat1.5 156ms52240kbC++203.2kb2023-09-01 07:59:172024-04-28 06:38:40

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 06:38:40]
  • 管理员手动重测本题所有提交记录
  • 测评结果:1.5
  • 用时:156ms
  • 内存:52240kb
  • [2023-09-01 07:59:18]
  • 评测
  • 测评结果:1.5
  • 用时:163ms
  • 内存:52164kb
  • [2023-09-01 07:59:17]
  • 提交

answer

#include "soccer.h"
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
// #define int ll
#define N 2005
using namespace std;
namespace 
{
    int a[N][N],pre[505][505][505];
    int suf[505][505][505];int tmp[N][N];
    int query(int l,int r,int L,int R)
    {
        return a[r][R]-a[l-1][R]-a[r][L-1]+a[l-1][L-1];
    }
}
int biggest_stadium(int n, std::vector<std::vector<int>> aa)
{
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
            a[i+1][j+1]=aa[i][j];
    if (n>30)
    {
        int nl=n,nr=0;
        bool bl=0;
        int tot=0;
        vector<pa>g;
        for (int i=1;i<=n;i++)
        {
            int l=n,r=0;
            for (int j=1;j<=n;j++)
                if (a[i][j]==0) l=min(l,j),r=max(r,j),tot++;
            for (int j=l;j<=r;j++)
                if (a[i][j]) return 0;
            if (l<=r) g.push_back(mp(l,r));
            if (l<=nl&&r>=nr)
            {
                if (bl==1) return 0;
                nl=l,nr=r;
                continue;
            }
            if (l>=nl&&r<=nr)
            {
                nl=l,nr=r;
                bl=1;
                continue;
            }
        }
        if (g.size()
        &&
        (g[0].se<g.back().fi||g.back().se<g[0].fi)) return 0;
        return tot;
    }
    for (int i=1;i<=n;i++)
        for (int j=1;j<=n;j++)
            a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
            
    int ans=0;
    for (int h=1;h<=n;h++)
    {
        for (int i=1;i<=n;i++)
            for (int j=i;j<=n;j++)
                pre[1][i][j]=(query(1,1,i,j)==0&&i<=h&&h<=j)*(j-i+1);
        for (int t=2;t<=n;t++)
        {
            for (int i=n;i>=1;i--)
                for (int j=i;j<=n;j++)
                    tmp[i][j]=max({pre[t-1][i][j],tmp[i+1][j],tmp[i][j-1]});
            for (int i=1;i<=n;i++)
                for (int j=i;j<=n;j++)
                    if (query(t,t,i,j)==0)
                    {
                        pre[t][i][j]=tmp[i][j]+j-i+1;
                    }
        }
        for (int i=1;i<=n;i++)
            for (int j=i;j<=n;j++)
                suf[n][i][j]=(query(n,n,i,j)==0&&i<=h&&h<=j)*(j-i+1);
        for (int t=n-1;t>=1;t--)
        {
            for (int i=n;i>=1;i--)
                for (int j=i;j<=n;j++)
                    tmp[i][j]=max({suf[t+1][i][j],tmp[i+1][j],tmp[i][j-1]});
            for (int i=1;i<=n;i++)
                for (int j=i;j<=n;j++)
                    if (query(t,t,i,j)==0)
                    {
                        suf[t][i][j]=tmp[i][j]+j-i+1;
                    }
        }
        for (int t=1;t<=n;t++)
            for (int i=1;i<=n;i++)
                for (int j=i;j<=n;j++)
                if (query(t,t,i,j)==0)
                {
                    ans=max(ans,pre[t][i][j]+suf[t][i][j]-(j-i+1));
                    // cout<<t<<" "<<i<<" "<<j<<" "<<ans<<" "<<pre[t][i][j]<<" "<<suf[t][i][j]<<endl;
                }
    }
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1.5
Acceptable Answer

Test #1:

score: 6
Accepted
time: 1ms
memory: 9964kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

score: 6
Accepted
time: 0ms
memory: 14020kb

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: 1ms
memory: 8224kb

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
0

result:

points 0.250 partial

Test #4:

score: 1.5
Acceptable Answer
time: 12ms
memory: 9880kb

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:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #5:

score: 1.5
Acceptable Answer
time: 156ms
memory: 52240kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
2000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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
0

result:

points 0.250 partial

Test #6:

score: 6
Accepted
time: 0ms
memory: 26612kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
9
1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 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
80

result:

ok ok

Test #7:

score: 6
Accepted
time: 0ms
memory: 28376kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
10
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 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
99

result:

ok ok

Test #8:

score: 6
Accepted
time: 2ms
memory: 14044kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Test #9:

score: 6
Accepted
time: 0ms
memory: 14316kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Subtask #2:

score: 0
Wrong Answer

Test #10:

score: 8
Accepted
time: 0ms
memory: 14320kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #11:

score: 8
Accepted
time: 1ms
memory: 14048kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #12:

score: 8
Accepted
time: 1ms
memory: 14016kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #13:

score: 8
Accepted
time: 1ms
memory: 14024kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
1 0 0
1 0 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
4

result:

ok ok

Test #14:

score: 0
Wrong Answer
time: 1ms
memory: 14312kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
7

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:

25%
Acceptable Answer

Dependency #2:

0%