#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
ll prefrow2[2001][2001];
ll prefcol2[2001][2001];
ll grid2[2001][2001];
bool checkrow2(ll a, ll b, ll row){
if (a>b) swap(a,b);
return (prefrow2[row][b] - prefrow2[row][a] + grid2[row][a] == 0);
}
bool checkcol2(ll a, ll b, ll col){
if (a>b) swap(a,b);
return (prefcol2[b][col] - prefcol2[a][col] + grid2[a][col] == 0);
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
ll ans = N*N;
FOR(i,0,N){
FOR(j,0,N){
grid2[i][j] = F[i][j];
ans -= F[i][j];
}
}
FOR(i,0,N){
prefrow2[i][0] = F[i][0];
FOR(j,1,N){
prefrow2[i][j] = prefrow2[i][j-1] + F[i][j];
}
}
FOR(j,0,N){
prefcol2[0][j] = F[0][j];
FOR(i,1,N){
prefcol2[i][j] = prefcol2[i-1][j] + F[i][j];
}
}
vector<vector<ll>> special;
FOR(i,0,N){
FOR(j,0,N){
vector<vector<ll>> sus = {{i-1,j}, {i+1,j}, {i,j-1}, {i,j+1}};
if (grid2[i][j] != 1){
bool flag = 0;
for (auto&k : sus){
if (0<=k[0] && k[0]<N && 0<=k[1] && k[1]<N){
if (grid2[k[0]][k[1]]==1) flag = 1;
}
}
if (flag==1 || i==0 || i==N-1 || j==0 || j==N-1) special.push_back({i,j});
}
}
}
for (auto&X : special){
for (auto&Y : special){
ll i = X[0], j = X[1], k = Y[0], l= Y[1];
if (grid2[i][j]==1 || grid2[k][l] == 1) continue;
bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l));
bool check2 = (checkrow2(l, j, k) && checkcol2(k, i, j));
if (!check1 && !check2) return 0;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4440 KB |
ok |
5 |
Correct |
1 ms |
4444 KB |
ok |
6 |
Partially correct |
1 ms |
4696 KB |
partial |
7 |
Partially correct |
3 ms |
8796 KB |
partial |
8 |
Partially correct |
64 ms |
29532 KB |
partial |
9 |
Partially correct |
785 ms |
134032 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4444 KB |
ok |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Partially correct |
1 ms |
4440 KB |
partial |
4 |
Partially correct |
1 ms |
4444 KB |
partial |
5 |
Partially correct |
1 ms |
4444 KB |
partial |
6 |
Partially correct |
1 ms |
4444 KB |
partial |
7 |
Partially correct |
1 ms |
4444 KB |
partial |
8 |
Correct |
1 ms |
4444 KB |
ok |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Partially correct |
1 ms |
4440 KB |
partial |
11 |
Partially correct |
1 ms |
4444 KB |
partial |
12 |
Partially correct |
1 ms |
4444 KB |
partial |
13 |
Correct |
1 ms |
4444 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Partially correct |
1 ms |
4440 KB |
partial |
5 |
Partially correct |
1 ms |
4444 KB |
partial |
6 |
Partially correct |
1 ms |
4444 KB |
partial |
7 |
Partially correct |
1 ms |
4444 KB |
partial |
8 |
Partially correct |
1 ms |
4444 KB |
partial |
9 |
Correct |
1 ms |
4444 KB |
ok |
10 |
Correct |
1 ms |
4444 KB |
ok |
11 |
Partially correct |
1 ms |
4440 KB |
partial |
12 |
Partially correct |
1 ms |
4444 KB |
partial |
13 |
Partially correct |
1 ms |
4444 KB |
partial |
14 |
Correct |
1 ms |
4444 KB |
ok |
15 |
Partially correct |
1 ms |
4444 KB |
partial |
16 |
Partially correct |
1 ms |
4444 KB |
partial |
17 |
Partially correct |
1 ms |
4444 KB |
partial |
18 |
Partially correct |
1 ms |
4444 KB |
partial |
19 |
Partially correct |
1 ms |
4444 KB |
partial |
20 |
Correct |
1 ms |
4444 KB |
ok |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Partially correct |
1 ms |
4444 KB |
partial |
23 |
Partially correct |
1 ms |
4444 KB |
partial |
24 |
Partially correct |
1 ms |
4444 KB |
partial |
25 |
Partially correct |
1 ms |
4444 KB |
partial |
26 |
Partially correct |
1 ms |
4444 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Partially correct |
1 ms |
4440 KB |
partial |
7 |
Partially correct |
1 ms |
4444 KB |
partial |
8 |
Partially correct |
1 ms |
4444 KB |
partial |
9 |
Partially correct |
1 ms |
4444 KB |
partial |
10 |
Partially correct |
1 ms |
4444 KB |
partial |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Partially correct |
1 ms |
4440 KB |
partial |
14 |
Partially correct |
1 ms |
4444 KB |
partial |
15 |
Partially correct |
1 ms |
4444 KB |
partial |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Partially correct |
1 ms |
4444 KB |
partial |
18 |
Partially correct |
1 ms |
4444 KB |
partial |
19 |
Partially correct |
1 ms |
4444 KB |
partial |
20 |
Partially correct |
1 ms |
4444 KB |
partial |
21 |
Partially correct |
1 ms |
4444 KB |
partial |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Partially correct |
1 ms |
4444 KB |
partial |
25 |
Partially correct |
1 ms |
4444 KB |
partial |
26 |
Partially correct |
1 ms |
4444 KB |
partial |
27 |
Partially correct |
1 ms |
4444 KB |
partial |
28 |
Partially correct |
1 ms |
4444 KB |
partial |
29 |
Partially correct |
1 ms |
4444 KB |
partial |
30 |
Partially correct |
1 ms |
6492 KB |
partial |
31 |
Partially correct |
1 ms |
6492 KB |
partial |
32 |
Partially correct |
1 ms |
6492 KB |
partial |
33 |
Partially correct |
1 ms |
6492 KB |
partial |
34 |
Correct |
1 ms |
6588 KB |
ok |
35 |
Correct |
1 ms |
6492 KB |
ok |
36 |
Partially correct |
2 ms |
6492 KB |
partial |
37 |
Partially correct |
1 ms |
6492 KB |
partial |
38 |
Partially correct |
1 ms |
6488 KB |
partial |
39 |
Partially correct |
1 ms |
6492 KB |
partial |
40 |
Partially correct |
1 ms |
6492 KB |
partial |
41 |
Partially correct |
1 ms |
6492 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Partially correct |
1 ms |
4440 KB |
partial |
7 |
Partially correct |
1 ms |
4444 KB |
partial |
8 |
Partially correct |
1 ms |
4444 KB |
partial |
9 |
Partially correct |
1 ms |
4444 KB |
partial |
10 |
Partially correct |
1 ms |
4444 KB |
partial |
11 |
Correct |
1 ms |
4444 KB |
ok |
12 |
Correct |
1 ms |
4444 KB |
ok |
13 |
Partially correct |
1 ms |
4440 KB |
partial |
14 |
Partially correct |
1 ms |
4444 KB |
partial |
15 |
Partially correct |
1 ms |
4444 KB |
partial |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Partially correct |
1 ms |
4444 KB |
partial |
18 |
Partially correct |
1 ms |
4444 KB |
partial |
19 |
Partially correct |
1 ms |
4444 KB |
partial |
20 |
Partially correct |
1 ms |
4444 KB |
partial |
21 |
Partially correct |
1 ms |
4444 KB |
partial |
22 |
Correct |
1 ms |
4444 KB |
ok |
23 |
Correct |
1 ms |
4444 KB |
ok |
24 |
Partially correct |
1 ms |
4444 KB |
partial |
25 |
Partially correct |
1 ms |
4444 KB |
partial |
26 |
Partially correct |
1 ms |
4444 KB |
partial |
27 |
Partially correct |
1 ms |
4444 KB |
partial |
28 |
Partially correct |
1 ms |
4444 KB |
partial |
29 |
Partially correct |
1 ms |
4444 KB |
partial |
30 |
Partially correct |
1 ms |
6492 KB |
partial |
31 |
Partially correct |
1 ms |
6492 KB |
partial |
32 |
Partially correct |
1 ms |
6492 KB |
partial |
33 |
Partially correct |
1 ms |
6492 KB |
partial |
34 |
Correct |
1 ms |
6588 KB |
ok |
35 |
Correct |
1 ms |
6492 KB |
ok |
36 |
Partially correct |
2 ms |
6492 KB |
partial |
37 |
Partially correct |
1 ms |
6492 KB |
partial |
38 |
Partially correct |
1 ms |
6488 KB |
partial |
39 |
Partially correct |
1 ms |
6492 KB |
partial |
40 |
Partially correct |
1 ms |
6492 KB |
partial |
41 |
Partially correct |
1 ms |
6492 KB |
partial |
42 |
Partially correct |
55 ms |
35260 KB |
partial |
43 |
Partially correct |
60 ms |
36148 KB |
partial |
44 |
Partially correct |
96 ms |
30288 KB |
partial |
45 |
Partially correct |
51 ms |
30036 KB |
partial |
46 |
Partially correct |
48 ms |
32012 KB |
partial |
47 |
Partially correct |
49 ms |
29748 KB |
partial |
48 |
Correct |
63 ms |
29788 KB |
ok |
49 |
Partially correct |
48 ms |
29520 KB |
partial |
50 |
Partially correct |
52 ms |
36324 KB |
partial |
51 |
Partially correct |
54 ms |
32136 KB |
partial |
52 |
Partially correct |
60 ms |
29664 KB |
partial |
53 |
Partially correct |
51 ms |
29780 KB |
partial |
54 |
Partially correct |
61 ms |
29528 KB |
partial |
55 |
Partially correct |
46 ms |
29532 KB |
partial |
56 |
Partially correct |
45 ms |
29732 KB |
partial |
57 |
Partially correct |
53 ms |
29776 KB |
partial |
58 |
Partially correct |
50 ms |
29836 KB |
partial |
59 |
Partially correct |
47 ms |
29836 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
4444 KB |
partial |
2 |
Correct |
1 ms |
4444 KB |
ok |
3 |
Correct |
1 ms |
4444 KB |
ok |
4 |
Correct |
1 ms |
4444 KB |
ok |
5 |
Correct |
1 ms |
4440 KB |
ok |
6 |
Correct |
1 ms |
4444 KB |
ok |
7 |
Partially correct |
1 ms |
4696 KB |
partial |
8 |
Partially correct |
3 ms |
8796 KB |
partial |
9 |
Partially correct |
64 ms |
29532 KB |
partial |
10 |
Partially correct |
785 ms |
134032 KB |
partial |
11 |
Partially correct |
1 ms |
4440 KB |
partial |
12 |
Partially correct |
1 ms |
4444 KB |
partial |
13 |
Partially correct |
1 ms |
4444 KB |
partial |
14 |
Partially correct |
1 ms |
4444 KB |
partial |
15 |
Partially correct |
1 ms |
4444 KB |
partial |
16 |
Correct |
1 ms |
4444 KB |
ok |
17 |
Correct |
1 ms |
4444 KB |
ok |
18 |
Partially correct |
1 ms |
4440 KB |
partial |
19 |
Partially correct |
1 ms |
4444 KB |
partial |
20 |
Partially correct |
1 ms |
4444 KB |
partial |
21 |
Correct |
1 ms |
4444 KB |
ok |
22 |
Partially correct |
1 ms |
4444 KB |
partial |
23 |
Partially correct |
1 ms |
4444 KB |
partial |
24 |
Partially correct |
1 ms |
4444 KB |
partial |
25 |
Partially correct |
1 ms |
4444 KB |
partial |
26 |
Partially correct |
1 ms |
4444 KB |
partial |
27 |
Correct |
1 ms |
4444 KB |
ok |
28 |
Correct |
1 ms |
4444 KB |
ok |
29 |
Partially correct |
1 ms |
4444 KB |
partial |
30 |
Partially correct |
1 ms |
4444 KB |
partial |
31 |
Partially correct |
1 ms |
4444 KB |
partial |
32 |
Partially correct |
1 ms |
4444 KB |
partial |
33 |
Partially correct |
1 ms |
4444 KB |
partial |
34 |
Partially correct |
1 ms |
4444 KB |
partial |
35 |
Partially correct |
1 ms |
6492 KB |
partial |
36 |
Partially correct |
1 ms |
6492 KB |
partial |
37 |
Partially correct |
1 ms |
6492 KB |
partial |
38 |
Partially correct |
1 ms |
6492 KB |
partial |
39 |
Correct |
1 ms |
6588 KB |
ok |
40 |
Correct |
1 ms |
6492 KB |
ok |
41 |
Partially correct |
2 ms |
6492 KB |
partial |
42 |
Partially correct |
1 ms |
6492 KB |
partial |
43 |
Partially correct |
1 ms |
6488 KB |
partial |
44 |
Partially correct |
1 ms |
6492 KB |
partial |
45 |
Partially correct |
1 ms |
6492 KB |
partial |
46 |
Partially correct |
1 ms |
6492 KB |
partial |
47 |
Partially correct |
55 ms |
35260 KB |
partial |
48 |
Partially correct |
60 ms |
36148 KB |
partial |
49 |
Partially correct |
96 ms |
30288 KB |
partial |
50 |
Partially correct |
51 ms |
30036 KB |
partial |
51 |
Partially correct |
48 ms |
32012 KB |
partial |
52 |
Partially correct |
49 ms |
29748 KB |
partial |
53 |
Correct |
63 ms |
29788 KB |
ok |
54 |
Partially correct |
48 ms |
29520 KB |
partial |
55 |
Partially correct |
52 ms |
36324 KB |
partial |
56 |
Partially correct |
54 ms |
32136 KB |
partial |
57 |
Partially correct |
60 ms |
29664 KB |
partial |
58 |
Partially correct |
51 ms |
29780 KB |
partial |
59 |
Partially correct |
61 ms |
29528 KB |
partial |
60 |
Partially correct |
46 ms |
29532 KB |
partial |
61 |
Partially correct |
45 ms |
29732 KB |
partial |
62 |
Partially correct |
53 ms |
29776 KB |
partial |
63 |
Partially correct |
50 ms |
29836 KB |
partial |
64 |
Partially correct |
47 ms |
29836 KB |
partial |
65 |
Partially correct |
840 ms |
211908 KB |
partial |
66 |
Partially correct |
966 ms |
215748 KB |
partial |
67 |
Partially correct |
754 ms |
155616 KB |
partial |
68 |
Partially correct |
805 ms |
132316 KB |
partial |
69 |
Partially correct |
823 ms |
143928 KB |
partial |
70 |
Partially correct |
804 ms |
154168 KB |
partial |
71 |
Partially correct |
774 ms |
134540 KB |
partial |
72 |
Partially correct |
764 ms |
134172 KB |
partial |
73 |
Correct |
1096 ms |
134008 KB |
ok |
74 |
Correct |
1122 ms |
134016 KB |
ok |
75 |
Partially correct |
732 ms |
133972 KB |
partial |
76 |
Partially correct |
858 ms |
243344 KB |
partial |
77 |
Partially correct |
861 ms |
243164 KB |
partial |
78 |
Partially correct |
780 ms |
154172 KB |
partial |
79 |
Partially correct |
772 ms |
143748 KB |
partial |
80 |
Partially correct |
811 ms |
143872 KB |
partial |
81 |
Partially correct |
825 ms |
140356 KB |
partial |
82 |
Partially correct |
748 ms |
143872 KB |
partial |
83 |
Partially correct |
915 ms |
174564 KB |
partial |
84 |
Partially correct |
766 ms |
133716 KB |
partial |
85 |
Partially correct |
720 ms |
133712 KB |
partial |
86 |
Partially correct |
760 ms |
133712 KB |
partial |
87 |
Partially correct |
744 ms |
133796 KB |
partial |
88 |
Partially correct |
750 ms |
134032 KB |
partial |
89 |
Partially correct |
747 ms |
133640 KB |
partial |
90 |
Partially correct |
787 ms |
134224 KB |
partial |
91 |
Partially correct |
744 ms |
134796 KB |
partial |
92 |
Partially correct |
759 ms |
159068 KB |
partial |
93 |
Partially correct |
753 ms |
157052 KB |
partial |
94 |
Partially correct |
749 ms |
154688 KB |
partial |
95 |
Partially correct |
742 ms |
154040 KB |
partial |
96 |
Partially correct |
754 ms |
154352 KB |
partial |
97 |
Partially correct |
768 ms |
154104 KB |
partial |
98 |
Partially correct |
836 ms |
143920 KB |
partial |
99 |
Partially correct |
767 ms |
157408 KB |
partial |
100 |
Partially correct |
768 ms |
134284 KB |
partial |
101 |
Partially correct |
770 ms |
134200 KB |
partial |
102 |
Partially correct |
767 ms |
134192 KB |
partial |
103 |
Partially correct |
754 ms |
134212 KB |
partial |
104 |
Partially correct |
790 ms |
134288 KB |
partial |
105 |
Partially correct |
766 ms |
134232 KB |
partial |
106 |
Partially correct |
770 ms |
134340 KB |
partial |
107 |
Partially correct |
754 ms |
134344 KB |
partial |
108 |
Partially correct |
867 ms |
215752 KB |
partial |
109 |
Partially correct |
870 ms |
215752 KB |
partial |