#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
#define F first
#define S second
#define sz size()
#define all(x) (x).begin(), (x).end()
const int N = 2002;
ll n;
vector<vector<int> > a;
ll prer[N][N], pred[N][N];
ll best = 0;
bool good()
{
vector<pair<ll,ll> > m;
// for(int i = 0; i <= n; i++) pre[i][0] = pre[0][i] = 0;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= n; j++)
{
prer[i][j] = prer[i][j-1]+(a[i-1][j-1]==2);
}
}
for(int j = 1; j <= n; j++)
{
for(int i = 1; i <= n; i++)
{
pred[i][j] = pred[i-1][j]+(a[i-1][j-1]==2);
}
}
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(a[i][j]==2) m.push_back({i,j});
for(int i = 0; i < m.sz; i++)
{
for(int j = i+1; j < m.sz; j++)
{
ll x1 = m[i].F , y1 = m[i].S , x2 = m[j].F , y2 = m[j].S;
x1++,y1++,x2++,y2++;
//if(mm)
//cout << x1 << " " << x2 << endl;
ll cnt = pred[x2-1][y1]-pred[x1-1][y1];
if(y1<=y2)
{
cnt += prer[x2][y2]-prer[x2][y1-1];
}
else if(y1>y2)
{
cnt+=prer[x2][y1]-prer[x2][y2-1];
}
//if(mm) cout << i << " " << j << " " << cnt << endl;
ll cnt2 = pred[x2-1][y2]-pred[x1-1][y2];
if(y1<=y2)
{
cnt2+= prer[x1][y2]-prer[x1][y1-1];
}
else
{
cnt2+=prer[x1][y1]-prer[x1][y2-1];
}
if((cnt==x2-x1+abs(y1-y2)+1)||(cnt2==x2-x1+abs(y1-y2)+1)) {} else return 0;
}
}
return 1;
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
best = 0;
n = N, a = F;
ll num = 0;
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(a[i][j]==0) a[i][j] = 2,num++;
if(good()) return num; else return 0;
}
Compilation message
soccer.cpp: In function 'bool good()':
soccer.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for(int i = 0; i < m.sz; i++)
| ^
soccer.cpp:39:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | for(int j = i+1; j < m.sz; j++)
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
5 ms |
3672 KB |
partial |
8 |
Partially correct |
207 ms |
26412 KB |
partial |
9 |
Execution timed out |
4567 ms |
183772 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 |
Partially correct |
0 ms |
348 KB |
partial |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Partially correct |
0 ms |
348 KB |
partial |
12 |
Partially correct |
0 ms |
348 KB |
partial |
13 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Partially correct |
0 ms |
348 KB |
partial |
12 |
Partially correct |
0 ms |
348 KB |
partial |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Partially correct |
0 ms |
440 KB |
partial |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
344 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Correct |
0 ms |
348 KB |
ok |
21 |
Correct |
0 ms |
348 KB |
ok |
22 |
Partially correct |
0 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 |
344 KB |
partial |
26 |
Partially correct |
0 ms |
344 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Partially correct |
0 ms |
348 KB |
partial |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
440 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
0 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 |
344 KB |
partial |
28 |
Partially correct |
0 ms |
344 KB |
partial |
29 |
Partially correct |
1 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
2652 KB |
partial |
31 |
Partially correct |
1 ms |
2652 KB |
partial |
32 |
Partially correct |
1 ms |
2652 KB |
partial |
33 |
Partially correct |
1 ms |
2652 KB |
partial |
34 |
Correct |
1 ms |
2648 KB |
ok |
35 |
Correct |
1 ms |
2652 KB |
ok |
36 |
Partially correct |
1 ms |
2652 KB |
partial |
37 |
Partially correct |
1 ms |
2492 KB |
partial |
38 |
Partially correct |
1 ms |
2648 KB |
partial |
39 |
Partially correct |
1 ms |
2648 KB |
partial |
40 |
Partially correct |
1 ms |
2648 KB |
partial |
41 |
Partially correct |
1 ms |
2652 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Partially correct |
0 ms |
348 KB |
partial |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Partially correct |
0 ms |
348 KB |
partial |
14 |
Partially correct |
0 ms |
348 KB |
partial |
15 |
Partially correct |
0 ms |
348 KB |
partial |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
0 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
440 KB |
partial |
19 |
Partially correct |
0 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
344 KB |
partial |
21 |
Partially correct |
0 ms |
348 KB |
partial |
22 |
Correct |
0 ms |
348 KB |
ok |
23 |
Correct |
0 ms |
348 KB |
ok |
24 |
Partially correct |
0 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 |
344 KB |
partial |
28 |
Partially correct |
0 ms |
344 KB |
partial |
29 |
Partially correct |
1 ms |
348 KB |
partial |
30 |
Partially correct |
0 ms |
2652 KB |
partial |
31 |
Partially correct |
1 ms |
2652 KB |
partial |
32 |
Partially correct |
1 ms |
2652 KB |
partial |
33 |
Partially correct |
1 ms |
2652 KB |
partial |
34 |
Correct |
1 ms |
2648 KB |
ok |
35 |
Correct |
1 ms |
2652 KB |
ok |
36 |
Partially correct |
1 ms |
2652 KB |
partial |
37 |
Partially correct |
1 ms |
2492 KB |
partial |
38 |
Partially correct |
1 ms |
2648 KB |
partial |
39 |
Partially correct |
1 ms |
2648 KB |
partial |
40 |
Partially correct |
1 ms |
2648 KB |
partial |
41 |
Partially correct |
1 ms |
2652 KB |
partial |
42 |
Partially correct |
20 ms |
26836 KB |
partial |
43 |
Partially correct |
21 ms |
27080 KB |
partial |
44 |
Partially correct |
20 ms |
26068 KB |
partial |
45 |
Partially correct |
20 ms |
26576 KB |
partial |
46 |
Partially correct |
21 ms |
27020 KB |
partial |
47 |
Partially correct |
20 ms |
27092 KB |
partial |
48 |
Execution timed out |
4523 ms |
23252 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
5 ms |
3672 KB |
partial |
9 |
Partially correct |
207 ms |
26412 KB |
partial |
10 |
Execution timed out |
4567 ms |
183772 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |