QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#155766#7120. Soccerbulijiojiodibuliduo#0 112ms6908kbC++173.4kb2023-09-02 04:23:252024-04-28 06:47:42

Judging History

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

  • [2024-04-28 06:47:42]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:112ms
  • 内存:6908kb
  • [2023-09-02 04:23:25]
  • 评测
  • 测评结果:0
  • 用时:130ms
  • 内存:6816kb
  • [2023-09-02 04:23:25]
  • 提交

answer

#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int bf(int N, std::vector<std::vector<int>> F) {
    vector<PII> rg;
    int cs=0;
    rep(i,0,N) rep(j,0,N) cs+=F[i][j];
    if (cs==0) return N*N;
    if (cs==1) {
        int x=0,y=0;
        rep(i,0,N) rep(j,0,N) if (F[i][j]) x=i,y=j;
        return N*N-min(x+1,N-x)*min(y+1,N-y);
    }
    rep(i,0,N) {
        int pl=N+1,pr=-1;
        rep(j,0,N) {
            if (F[i][j]==0) pl=min(pl,j),pr=max(pr,j);
        }
        if (pl<=pr) {
            rg.pb(mp(pl,pr));
            rep(j,pl,pr+1) if (F[i][j]==1) { return 0; }
        }
    }
    for (auto q1:rg) for (auto q2:rg) {
        auto p1=q1,p2=q2;
        if (p1>p2) swap(p1,p2);
        if (p1.fi<p2.fi&&p1.se<p2.se) return 0;
    }
    rg.clear();
    rep(j,0,N) {
        int pl=N+1,pr=-1;
        rep(i,0,N) {
            if (F[i][j]==0) pl=min(pl,i),pr=max(pr,i);
        }
        if (pl<=pr) {
            rg.pb(mp(pl,pr));
            rep(i,pl,pr+1) if (F[i][j]==1) { return 0; }
        }
    }
    for (auto q1:rg) for (auto q2:rg) {
        auto p1=q1,p2=q2;
        if (p1.fi<p2.fi&&p1.se<p2.se) return 0;
    }
    int r=0;
    rep(i,0,N) rep(j,0,N) {
        if (F[i][j]==0) ++r;
    }
    return r;
}

const int N=2010;
int stk[N],top,a[N],l[N],r[N],T;
vector<array<int,3>> seg;
void dfs(int u,int L,int R) {
    if (a[u]>T) seg.pb({L-1,R-1,a[u]});
    if (l[u]) dfs(l[u],L,u-1);
    if (r[u]) dfs(r[u],u+1,R);
}
void build(VI v,int th) {
    int top=0;
    T=th;
    int n=SZ(v);
    rep(i,1,n+1) a[i]=v[i-1];
    rep(i,1,n+1) l[i]=r[i]=0;
    rep(i,1,n+1) {
        int k=top;
        while (k>0&&a[stk[k-1]]>a[i]) --k;
        if (k) r[stk[k-1]]=i;
        if (k<top) l[i]=stk[k];
        stk[k++]=i;
        top=k;
    }
    dfs(stk[0],1,n);
    // rt is stk[0]
}

int biggest_stadium(int n, std::vector<std::vector<int>> F)
{
    //if (n>500) return bf(n,F);
    vector<vector<int>> nxt(n+1,VI(n));
    rep(i,0,n) {
        nxt[n][i]=n;
        per(L,0,n) {
            if (F[i][L]) nxt[L][i]=L;
            else nxt[L][i]=nxt[L+1][i];
        }
    }
    int ans=0;
    vector<array<int,3>> dp;

    rep(L,0,n) {
        auto pd=dp; dp.clear();
        seg.clear();
        build(nxt[L],L);
        for (auto s:seg) {
            int R=s[2];
            int u=s[0],v=s[1];
            int r=(R-L)*(v-u+1);
            for (auto [xx,yy,w]:pd) if (u<=xx&&yy<=v) {
                r=max(r,w+((v-u)-(yy-xx))*(R-L));
                //printf("???????? %d %d %d\n",xx,yy,w+((yy-xx)-(v-u))*(R-L));
            }
            ans=max(ans,r);
            //printf("?? L %d u %d v %d R %d ret %d\n",L,u,v,R,r);
            dp.pb({u,v,r});
        }
    }
    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

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

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: 2ms
memory: 3968kb

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
9800

result:

points 0.250 partial

Test #4:

score: 6
Accepted
time: 112ms
memory: 6908kb

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
236536

result:

ok ok

Test #5:

score: 0
Time Limit Exceeded

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:


result:


Subtask #2:

score: 0
Wrong Answer

Test #10:

score: 2
Acceptable Answer
time: 1ms
memory: 3804kb

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: 4092kb

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: 3824kb

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: 0ms
memory: 3808kb

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: 3832kb

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: 3844kb

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%