QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#162290#7120. Socceryzy18 2145ms313600kbC++173.8kb2023-09-03 07:49:022024-04-28 06:51:02

Judging History

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

  • [2024-04-28 06:51:02]
  • 管理员手动重测本题所有提交记录
  • 测评结果:8
  • 用时:2145ms
  • 内存:313600kb
  • [2023-09-03 07:49:03]
  • 评测
  • 测评结果:8
  • 用时:2137ms
  • 内存:315732kb
  • [2023-09-03 07:49:02]
  • 提交

answer

#include <bits/stdc++.h>

#include "soccer.h"

#if defined(LOCAL)
#define DBG_MACRO_NO_WARNING
#include <dbg.hpp>

#include "grader.cpp"
#else
#define dbg(x...) (0)
#endif

using namespace std;

using ll = long long;

// #define int ll
#define rep(i, f, t) for (int i = (f), ed##i = (t); i <= ed##i; ++i)
#define re(i, t) rep (i, 1, t)
#define per(i, t, f) for (int i = (t), ed##i = (f); i >= ed##i; --i)
#define ste(i, f, t, s) for (int i = (f), ed##i = (t); i <= ed##i; i += s)
#define nxt(i, f, g) for (int i = g.h[f]; i; i = g.e[i].n)
#define umod(x) ((x) >= mo && ((x) -= mo))
#define dmod(x) ((x) < 0 && ((x) += mo))
#define y1 y1__
#define fio(x) (freopen(x ".in", "r", stdin), freopen(x ".out", "w", stdout))

template <class T, class E>
__attribute__((always_inline)) inline void up(T &x, E &&y) {
  if (x < y) x = y;
}
template <class T, class E>
__attribute__((always_inline)) inline void down(T &x, E &&y) {
  if (y < x) x = y;
}

namespace qingwa {
const int N = 2009;
const int M = 309;
const int inf = 1e9 + 7;
int n, a[N][N], dp[M][M][M][2], mx[M][M][M][2], Mx[M][M][2], Mx2[M][M][2];

inline int Main() {
  re (i, n)
    re (j, n) a[i][j] += a[i][j - 1];
  int ans = 0;
  re (i, n) {
    // if (i != 1) continue;
    memset(mx, ~0x3f, sizeof mx);
    rep (l, 0, n + 1)
      rep (r, 0, n + 1) mx[i + 1][l][r][0] = mx[i][l][r][1] = Mx[l][r][0] = Mx[l][r][1] = 0;
    per (j, i, 1) {
      re (l, n)
        rep (r, l, n) {
          dp[j][l][r][0] = mx[j + 1][l][r][0] + ((a[j][r] - a[j][l - 1]) ? -inf : r - l + 1);
          // cerr << "dpup " << j << ' ' << l << ' ' << r << ' ' << dp[j][l][r][0] << '\n';
          up(Mx[l][r][0], dp[j][l][r][0]);
        }
      per (len, n, 1)
        re (l, n) {
          int r = l + len - 1;
          if (r > n) break;
          mx[j][l][r][0] = max({mx[j][l - 1][r][0], mx[j][l][r + 1][0], dp[j][l][r][0]});
        }
    }
    rep (j, i + 1, n) {
      re (l, n)
        rep (r, l, n) {
          dp[j][l][r][1] = mx[j - 1][l][r][1] + ((a[j][r] - a[j][l - 1]) ? -inf : r - l + 1);
          // cerr << "dpdown " << j << ' ' << l << ' ' << r << ' ' << dp[j][l][r][1] << '\n';
          up(Mx[l][r][1], dp[j][l][r][1]);
        }
      per (len, n, 1)
        re (l, n) {
          int r = l + len - 1;
          if (r > n) break;
          mx[j][l][r][1] = max({mx[j][l - 1][r][1], mx[j][l][r + 1][1], dp[j][l][r][1]});
        }
    }
    re (len, n)
      re (l, n) {
        int r = l + len - 1;
        if (r > n) break;
        rep (b, 0, 1) Mx2[l][r][b] = max({Mx2[l + 1][r][b], Mx2[l][r - 1][b], Mx[l][r][b]});
      }
    re (l, n)
      rep (r, l, n) {
        up(ans, Mx[l][r][0] + Mx2[l][r][1]);
        up(ans, Mx2[l][r][0] + Mx[l][r][1]);
      }
  }
  return ans;
  // re (i, n) {
  //   int t = i & 1;
  //   re (l, n)
  //     rep (r, l, n) {
  //       dp[t][l][r][0] = mx[!t][l][r][0] + ((a[i][r] - a[i][l - 1]) ? -inf : r - l + 1);
  //       dp[t][l][r][1] = mx[!t][l][r][1] + ((a[i][r] - a[i][l - 1]) ? -inf : r - l + 1);
  //       up(ans, dp[t][l][r][0]);
  //       up(ans, dp[t][l][r][1]);
  //     }
  //   re (len, n)
  //     re (l, n) {
  //       int r = l + len - 1;
  //       if (r > n) break;
  //       // if(a[])
  //       mx[t][l][r][0] = max({mx[t][l + 1][r][0], mx[t][l][r - 1][0], dp[t][l][r][0]});
  //     }
  //   per (len, n, 1)
  //     re (l, n) {
  //       int r = l + len - 1;
  //       if (r > n) break;
  //       mx[t][l][r][1] =
  //           max({mx[t][l - 1][r][1], mx[t][l][r + 1][1], dp[t][l][r][0], dp[t][l][r][1]});
  //     }
  // }
  // return ans;
}
}  // namespace qingwa

int biggest_stadium(int N, std::vector<std::vector<int>> F) {
  using namespace qingwa;
  n = N;
  rep (i, 0, n - 1)
    rep (j, 0, n - 1) a[i + 1][j + 1] = F[i][j];
  return qingwa::Main();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 6
Accepted
time: 7ms
memory: 239388kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

score: 6
Accepted
time: 38ms
memory: 239568kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #3:

score: 6
Accepted
time: 2145ms
memory: 313600kb

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
9850

result:

ok ok

Test #4:

score: 0
Runtime Error

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: 8
Accepted

Test #10:

score: 8
Accepted
time: 43ms
memory: 239592kb

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: 49ms
memory: 241372kb

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: 40ms
memory: 239808kb

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: 46ms
memory: 241364kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
1 0 0
1 0 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
4

result:

ok ok

Test #14:

score: 8
Accepted
time: 52ms
memory: 239336kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #15:

score: 8
Accepted
time: 48ms
memory: 239392kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 1
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
7

result:

ok ok

Test #16:

score: 8
Accepted
time: 52ms
memory: 239732kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
9

result:

ok ok

Test #17:

score: 8
Accepted
time: 46ms
memory: 239312kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
1 0 0
0 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #18:

score: 8
Accepted
time: 41ms
memory: 241376kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
1 1 1
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
2

result:

ok ok

Test #19:

score: 8
Accepted
time: 51ms
memory: 239628kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
1 0 1
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
3

result:

ok ok

Test #20:

score: 8
Accepted
time: 53ms
memory: 241368kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
1 0 1
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #21:

score: 22
Accepted
time: 116ms
memory: 243504kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 0
0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
43

result:

ok ok

Test #22:

score: 22
Accepted
time: 119ms
memory: 241948kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 0
0 0 0 0 1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
35

result:

ok ok

Test #23:

score: 5.5
Acceptable Answer
time: 112ms
memory: 241760kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 1 0 0 0
0 0 0 0 0 1 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
0 0 0 0 1 0 0
1 0 0 0 0 1 0
0 1 0 0 1 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
22

result:

points 0.250 partial

Test #24:

score: 22
Accepted
time: 118ms
memory: 243408kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 1 1 0 1 0
1 1 0 0 0 1 0
0 1 0 0 0 0 1
0 0 0 1 1 1 0
0 0 1 0 1 0 0
1 0 1 0 0 1 1
0 1 1 0 1 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Test #25:

score: 22
Accepted
time: 115ms
memory: 243432kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 1 1 0 0 1
1 1 1 1 1 1 1
0 0 0 1 1 1 1
1 1 1 1 0 1 1
1 1 1 1 1 0 1
1 0 0 0 0 0 0
1 0 0 1 0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
9

result:

ok ok

Test #26:

score: 22
Accepted
time: 123ms
memory: 243680kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 0 1 1
1 1 1 0 0 0 1
1 1 1 1 0 1 1
1 1 1 1 0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #27:

score: 22
Accepted
time: 125ms
memory: 243408kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
1 1 1 1 0 1 1
1 1 1 1 0 1 1
1 1 1 1 0 1 1
1 1 0 0 0 1 1
1 0 0 0 0 1 1
1 1 1 1 0 1 1
1 1 1 1 0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
12

result:

ok ok

Test #28:

score: 0
Wrong Answer
time: 119ms
memory: 243428kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
1 0 1 1 1 1 1
0 0 1 1 1 1 1
0 0 0 0 1 1 1
0 0 0 1 1 1 1
1 0 0 1 1 1 1
1 0 1 1 1 1 1
1 0 1 1 1 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
14

result:

wrong answer wrong

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%