#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
typedef long long ll;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
ll rand_int(ll l, ll r) { //[l, r]
#ifdef LOCAL
static mt19937_64 gen;
#else
static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
return uniform_int_distribution<ll>(l, r)(gen);
}
template <uint MD> struct ModInt {
using M = ModInt;
const static M G;
uint v;
ModInt(ll _v = 0) { set_v(_v % MD + MD); }
M& set_v(uint _v) {
v = (_v < MD) ? _v : _v - MD;
return *this;
}
explicit operator bool() const { return v != 0; }
M operator-() const { return M() - *this; }
M operator+(const M& r) const { return M().set_v(v + r.v); }
M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
M operator/(const M& r) const { return *this * r.inv(); }
M& operator+=(const M& r) { return *this = *this + r; }
M& operator-=(const M& r) { return *this = *this - r; }
M& operator*=(const M& r) { return *this = *this * r; }
M& operator/=(const M& r) { return *this = *this / r; }
bool operator==(const M& r) const { return v == r.v; }
M pow(ll n) const {
M x = *this, r = 1;
while (n) {
if (n & 1) r *= x;
x *= x;
n >>= 1;
}
return r;
}
M inv() const { return pow(MD - 2); }
friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;
template<> const Mint Mint::G = Mint(3);
#include "soccer.h"
#define N_ 2010
int Up[N_][N_], Down[N_][N_], n, D[N_][N_], uu[N_][N_], dd[N_][N_];
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
n = N;
rep(i,n){
rep(j,n){
if(F[i][j]){
Up[i][j]=i;
Down[i][j]=i;
}
else{
if(i) Up[i][j]=Up[i-1][j];
else Up[i][j] = -1;
}
}
}
per(i,n){
rep(j,n){
if(!F[i][j]){
if(i==n-1)Down[i][j]=n;
else Down[i][j] = Down[i+1][j];
}
}
}
int res=0;
rep(i,n){
rng(len,0,n-1){
rep(b,n-len){
int e = b+len;
if(!len){
if(F[i][b])D[b][e]=-1;
else{
uu[b][e] = Up[i][b];
dd[b][e] = Down[i][b];
D[b][e]=dd[b][e]-uu[b][e]-1;
}
}
else{
if(D[b][e-1]==-1 || D[b+1][e]==-1){
D[b][e]=-1;
continue;
}
uu[b][e] = max(uu[b][e-1],uu[b+1][e]);
dd[b][e] = min(dd[b][e-1],dd[b+1][e]);
D[b][e] = max(D[b][e-1], D[b+1][e]) + dd[b][e]-uu[b][e]-1;
}
res=max(res,D[b][e]);
}
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
448 KB |
ok |
4 |
Correct |
0 ms |
604 KB |
ok |
5 |
Correct |
0 ms |
452 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
3 ms |
2704 KB |
ok |
8 |
Correct |
249 ms |
16208 KB |
ok |
9 |
Execution timed out |
4573 ms |
112672 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
356 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
1 ms |
344 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
356 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
344 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
1 ms |
604 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
0 ms |
604 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
348 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
1 ms |
348 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
0 ms |
604 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
448 KB |
ok |
5 |
Correct |
0 ms |
604 KB |
ok |
6 |
Correct |
0 ms |
356 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
344 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
1 ms |
604 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
604 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
1 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
604 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Correct |
0 ms |
348 KB |
ok |
30 |
Correct |
1 ms |
860 KB |
ok |
31 |
Correct |
1 ms |
1112 KB |
ok |
32 |
Correct |
1 ms |
860 KB |
ok |
33 |
Correct |
1 ms |
860 KB |
ok |
34 |
Correct |
1 ms |
860 KB |
ok |
35 |
Correct |
1 ms |
1028 KB |
ok |
36 |
Correct |
1 ms |
860 KB |
ok |
37 |
Correct |
1 ms |
860 KB |
ok |
38 |
Correct |
1 ms |
912 KB |
ok |
39 |
Correct |
1 ms |
860 KB |
ok |
40 |
Correct |
1 ms |
860 KB |
ok |
41 |
Correct |
1 ms |
860 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
448 KB |
ok |
5 |
Correct |
0 ms |
604 KB |
ok |
6 |
Correct |
0 ms |
356 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
1 ms |
344 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Correct |
1 ms |
604 KB |
ok |
18 |
Correct |
0 ms |
348 KB |
ok |
19 |
Correct |
0 ms |
604 KB |
ok |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Correct |
0 ms |
348 KB |
ok |
25 |
Correct |
1 ms |
348 KB |
ok |
26 |
Correct |
0 ms |
348 KB |
ok |
27 |
Correct |
0 ms |
604 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Correct |
0 ms |
348 KB |
ok |
30 |
Correct |
1 ms |
860 KB |
ok |
31 |
Correct |
1 ms |
1112 KB |
ok |
32 |
Correct |
1 ms |
860 KB |
ok |
33 |
Correct |
1 ms |
860 KB |
ok |
34 |
Correct |
1 ms |
860 KB |
ok |
35 |
Correct |
1 ms |
1028 KB |
ok |
36 |
Correct |
1 ms |
860 KB |
ok |
37 |
Correct |
1 ms |
860 KB |
ok |
38 |
Correct |
1 ms |
912 KB |
ok |
39 |
Correct |
1 ms |
860 KB |
ok |
40 |
Correct |
1 ms |
860 KB |
ok |
41 |
Correct |
1 ms |
860 KB |
ok |
42 |
Correct |
140 ms |
15488 KB |
ok |
43 |
Correct |
138 ms |
15244 KB |
ok |
44 |
Correct |
175 ms |
16272 KB |
ok |
45 |
Correct |
199 ms |
16268 KB |
ok |
46 |
Correct |
149 ms |
15696 KB |
ok |
47 |
Correct |
257 ms |
16216 KB |
ok |
48 |
Correct |
192 ms |
16252 KB |
ok |
49 |
Correct |
181 ms |
16208 KB |
ok |
50 |
Correct |
187 ms |
16472 KB |
ok |
51 |
Correct |
145 ms |
15696 KB |
ok |
52 |
Correct |
138 ms |
13424 KB |
ok |
53 |
Correct |
122 ms |
12916 KB |
ok |
54 |
Correct |
126 ms |
13396 KB |
ok |
55 |
Correct |
143 ms |
13904 KB |
ok |
56 |
Correct |
170 ms |
16220 KB |
ok |
57 |
Correct |
224 ms |
16208 KB |
ok |
58 |
Correct |
218 ms |
16208 KB |
ok |
59 |
Correct |
200 ms |
16212 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
448 KB |
ok |
5 |
Correct |
0 ms |
604 KB |
ok |
6 |
Correct |
0 ms |
452 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
3 ms |
2704 KB |
ok |
9 |
Correct |
249 ms |
16208 KB |
ok |
10 |
Execution timed out |
4573 ms |
112672 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |