#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
#define vec vector
#define arr array
vec<vec<int>> rotate(vec<vec<int>> f) {
vec<vec<int>> res = f;
int n = f.size();
for(int i = 0; i<n; i++) {
for(int j = 0; j<n; j++) {
res[i][j] = f[n-j-1][i];
}
}
return res;
}
vec<vec<int>> rotate_back(vec<vec<int>> f) {
return rotate(rotate(rotate(f)));
}
vec<vec<int>> solve(vec<vec<int>> f) {
int n = f.size();
vec<vec<int>> dp_r_space(n, vec<int>(n, 0));
for(int i = 1; i<n; i++) {
for(int j = 0; j<n; j++) {
if(f[i-1][j] == 1) continue;
else dp_r_space[i][j] = 1+dp_r_space[i-1][j];
}
}
vec<vec<int>> res(n, vec<int>(n, 0));
for(int i = 0; i<n; i++) {
for(int j = 0; j<n; j++) {
if(f[i][j] == 1) continue;
res[i][j] = dp_r_space[i][j];
int cur = dp_r_space[i][j];
for(int k = j+1; k<n; k++) {
if(f[i][k] == 1) break;
cur = min(cur, dp_r_space[i][k]);
res[i][j] += cur;
}
}
}
return res;
}
int biggest_stadium(int n, vec<vec<int>> f)
{
arr<vec<vec<int>>, 4> res;
res[0] = solve(f);
f = rotate(f);
res[1] = rotate_back(solve(f));
f = rotate(f);
res[2] = rotate(rotate(solve(f)));
f = rotate(f);
res[3] = rotate(solve(f));
int ans = 0;
for(int i = 0; i<n; i++) {
for(int j = 0; j<n; j++) {
int sum = 0;
for(int k = 0; k<4; k++) sum += res[k][i][j];
ans = max(ans, sum);
}
}
return ans+1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
5 ms |
600 KB |
ok |
8 |
Correct |
197 ms |
9812 KB |
ok |
9 |
Execution timed out |
4532 ms |
102536 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Incorrect |
0 ms |
348 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Incorrect |
0 ms |
348 KB |
wrong |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
344 KB |
ok |
8 |
Correct |
5 ms |
600 KB |
ok |
9 |
Correct |
197 ms |
9812 KB |
ok |
10 |
Execution timed out |
4532 ms |
102536 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |