#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 prefrow[2001][2001];
ll prefcol[2001][2001];
ll grid[2001][2001];
bool checkrow(ll a, ll b, ll row){
if (a>b) swap(a,b);
return (prefrow[row][b] - prefrow[row][a] + grid[row][a] == 0);
}
bool checkcol(ll a, ll b, ll col){
if (a>b) swap(a,b);
return (prefcol[b][col] - prefcol[a][col] + grid[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){
grid[i][j] = F[i][j];
ans -= F[i][j];
}
}
FOR(i,0,N){
prefrow[i][0] = F[i][0];
FOR(j,1,N){
prefrow[i][j] = prefrow[i][j-1] + F[i][j];
}
}
FOR(j,0,N){
prefcol[0][j] = F[0][j];
FOR(i,1,N){
prefcol[i][j] = prefcol[i-1][j] + F[i][j];
}
}
FOR(i,0,N){
FOR(j,0,N){
FOR(k,0,N){
FOR(l,0,N){
if (grid[i][j]==1 || grid[k][l] == 1) continue;
bool check1 = (checkrow(l, j, i) && checkcol(k, i, l));
bool check2 = (checkrow(l, j, k) && checkcol(k, i, j));
if (!check1 && !check2){
// cout << i << " " << j << " " << k << " " << l << endl;
// cout << checkrow(0,3,0) << endl;
// cout << checkcol(4,0,3) << endl;
return 0;
}
}
}
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
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 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
7 ms |
1884 KB |
partial |
8 |
Partially correct |
186 ms |
14224 KB |
partial |
9 |
Execution timed out |
4576 ms |
125780 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 |
Partially correct |
0 ms |
348 KB |
partial |
4 |
Partially correct |
1 ms |
348 KB |
partial |
5 |
Partially correct |
1 ms |
348 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Partially correct |
1 ms |
348 KB |
partial |
11 |
Partially correct |
1 ms |
348 KB |
partial |
12 |
Partially correct |
1 ms |
344 KB |
partial |
13 |
Correct |
1 ms |
344 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
1 ms |
348 KB |
ok |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Partially correct |
1 ms |
348 KB |
partial |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
1 ms |
348 KB |
ok |
11 |
Partially correct |
1 ms |
348 KB |
partial |
12 |
Partially correct |
1 ms |
348 KB |
partial |
13 |
Partially correct |
1 ms |
344 KB |
partial |
14 |
Correct |
1 ms |
344 KB |
ok |
15 |
Partially correct |
1 ms |
344 KB |
partial |
16 |
Partially correct |
0 ms |
348 KB |
partial |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Correct |
1 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Partially correct |
1 ms |
348 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
348 KB |
partial |
25 |
Partially correct |
1 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
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 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1 ms |
348 KB |
partial |
8 |
Partially correct |
1 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Partially correct |
1 ms |
348 KB |
partial |
14 |
Partially correct |
1 ms |
348 KB |
partial |
15 |
Partially correct |
1 ms |
344 KB |
partial |
16 |
Correct |
1 ms |
344 KB |
ok |
17 |
Partially correct |
1 ms |
344 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
348 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
1 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Partially correct |
1 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
344 KB |
partial |
30 |
Partially correct |
0 ms |
604 KB |
partial |
31 |
Partially correct |
1 ms |
604 KB |
partial |
32 |
Partially correct |
1 ms |
604 KB |
partial |
33 |
Partially correct |
1 ms |
604 KB |
partial |
34 |
Correct |
2 ms |
604 KB |
ok |
35 |
Correct |
2 ms |
604 KB |
ok |
36 |
Partially correct |
1 ms |
604 KB |
partial |
37 |
Partially correct |
1 ms |
604 KB |
partial |
38 |
Partially correct |
1 ms |
604 KB |
partial |
39 |
Partially correct |
1 ms |
604 KB |
partial |
40 |
Partially correct |
1 ms |
604 KB |
partial |
41 |
Partially correct |
1 ms |
604 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
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 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1 ms |
348 KB |
partial |
8 |
Partially correct |
1 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Partially correct |
1 ms |
348 KB |
partial |
14 |
Partially correct |
1 ms |
348 KB |
partial |
15 |
Partially correct |
1 ms |
344 KB |
partial |
16 |
Correct |
1 ms |
344 KB |
ok |
17 |
Partially correct |
1 ms |
344 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
348 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
1 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
348 KB |
partial |
27 |
Partially correct |
1 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
344 KB |
partial |
30 |
Partially correct |
0 ms |
604 KB |
partial |
31 |
Partially correct |
1 ms |
604 KB |
partial |
32 |
Partially correct |
1 ms |
604 KB |
partial |
33 |
Partially correct |
1 ms |
604 KB |
partial |
34 |
Correct |
2 ms |
604 KB |
ok |
35 |
Correct |
2 ms |
604 KB |
ok |
36 |
Partially correct |
1 ms |
604 KB |
partial |
37 |
Partially correct |
1 ms |
604 KB |
partial |
38 |
Partially correct |
1 ms |
604 KB |
partial |
39 |
Partially correct |
1 ms |
604 KB |
partial |
40 |
Partially correct |
1 ms |
604 KB |
partial |
41 |
Partially correct |
1 ms |
604 KB |
partial |
42 |
Partially correct |
29 ms |
14168 KB |
partial |
43 |
Partially correct |
20 ms |
14680 KB |
partial |
44 |
Partially correct |
26 ms |
14728 KB |
partial |
45 |
Partially correct |
18 ms |
14684 KB |
partial |
46 |
Partially correct |
30 ms |
14676 KB |
partial |
47 |
Partially correct |
18 ms |
14684 KB |
partial |
48 |
Execution timed out |
4569 ms |
14684 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
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 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
7 ms |
1884 KB |
partial |
9 |
Partially correct |
186 ms |
14224 KB |
partial |
10 |
Execution timed out |
4576 ms |
125780 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |