#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define P push
#define I insert
typedef long long ll;
int n,ans;
bool valid(vector<int> v){
bool arr[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(v[i*n+j])arr[i][j]=1;
else arr[i][j]=0;
}
}
int pos[n][n][4];
for(int i=0;i<n;i++){
int cur=-1;
//left
for(int j=0;j<n;j++){
pos[i][j][0]=cur;
if(arr[i][j])cur=j;
}
cur=n;
//right
for(int j=n-1;j>=0;j--){
pos[i][j][1]=cur;
if(arr[i][j])cur=j;
}
cur=-1;
//up
for(int j=0;j<n;j++){
pos[j][i][2]=cur;
if(arr[j][i])cur=j;
}
cur=n;
//down
for(int j=n-1;j>=0;j--){
pos[j][i][3]=cur;
if(arr[j][i])cur=j;
}
}
for(int a=0;a<n;a++){
for(int b=0;b<n;b++){
if(arr[a][b]==1)continue;
for(int c=0;c<n;c++){
for(int d=0;d<n;d++){
if(arr[c][d]==1)continue;
bool ok1=false,ok2=false;
if(pos[a][b][1]>d && pos[c][d][2]<a)ok1=true;
if(pos[a][b][3]>c && pos[c][d][0]<b)ok2=true;
if(!ok1 && !ok2)return false;
}
}
}
}
return true;
}
void comput(vector<int> v,int cur,int siz){
if(cur==n*n){
if(valid(v))ans=max(ans,siz);
return;
}
if(v[cur]==-1){
v[cur]=0;
comput(v,cur+1,siz+1);
v[cur]=1;
comput(v,cur+1,siz);
v[cur]=-1;
}
else comput(v,cur+1,siz);
return;
}
int biggest_stadium(int N, vector<vector<int>> F){
n=N;
ans=0;
int trees=0;pair<int,int> tr;
for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(F[i][j]){trees++;tr={i,j};}
if(trees==0)return n*n;
if(trees==1){
int x=tr.F,y=tr.S;
int a=n*x+y*(n-x) , b=n*x+(n-x)*(n-y-1) , c=n*(n-x-1)+y*(x+1) , d=n*(n-x-1)+(x+1)*(n-y-1);
return max(max(a,b),max(c,d));
}
vector<int> v;
v.assign(n*n,-1);
if(n<=3){
for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(F[i][j])v[i*n+j]=1;
comput(v,0,0);
return ans;
}
for(int i=0;i<n;i++)for(int j=0;j<n;j++){
if(F[i][j])v[i*n+j]=1;
else v[i*n+j]=0;
}
if(valid(v))return n*n-trees;
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
344 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
344 KB |
ok |
8 |
Correct |
16 ms |
2396 KB |
ok |
9 |
Correct |
255 ms |
31768 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 |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
1 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
344 KB |
ok |
9 |
Correct |
1 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 |
0 ms |
348 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 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
344 KB |
ok |
10 |
Correct |
1 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Partially correct |
1 ms |
348 KB |
partial |
16 |
Partially correct |
0 ms |
348 KB |
partial |
17 |
Partially correct |
1 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
1 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 |
1 ms |
348 KB |
partial |
24 |
Partially correct |
0 ms |
372 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 |
0 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 |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
344 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
1 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
1 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
348 KB |
partial |
21 |
Partially correct |
1 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 |
1 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
372 KB |
partial |
27 |
Partially correct |
1 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
600 KB |
partial |
30 |
Partially correct |
1 ms |
344 KB |
partial |
31 |
Partially correct |
0 ms |
348 KB |
partial |
32 |
Partially correct |
1 ms |
344 KB |
partial |
33 |
Partially correct |
0 ms |
348 KB |
partial |
34 |
Correct |
1 ms |
348 KB |
ok |
35 |
Correct |
1 ms |
348 KB |
ok |
36 |
Partially correct |
0 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
1 ms |
348 KB |
partial |
39 |
Partially correct |
1 ms |
344 KB |
partial |
40 |
Partially correct |
0 ms |
348 KB |
partial |
41 |
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 |
0 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 |
0 ms |
348 KB |
ok |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
1 ms |
344 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
0 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
0 ms |
348 KB |
ok |
17 |
Partially correct |
1 ms |
348 KB |
partial |
18 |
Partially correct |
0 ms |
348 KB |
partial |
19 |
Partially correct |
1 ms |
348 KB |
partial |
20 |
Partially correct |
0 ms |
348 KB |
partial |
21 |
Partially correct |
1 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 |
1 ms |
348 KB |
partial |
26 |
Partially correct |
0 ms |
372 KB |
partial |
27 |
Partially correct |
1 ms |
348 KB |
partial |
28 |
Partially correct |
0 ms |
348 KB |
partial |
29 |
Partially correct |
1 ms |
600 KB |
partial |
30 |
Partially correct |
1 ms |
344 KB |
partial |
31 |
Partially correct |
0 ms |
348 KB |
partial |
32 |
Partially correct |
1 ms |
344 KB |
partial |
33 |
Partially correct |
0 ms |
348 KB |
partial |
34 |
Correct |
1 ms |
348 KB |
ok |
35 |
Correct |
1 ms |
348 KB |
ok |
36 |
Partially correct |
0 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
348 KB |
partial |
38 |
Partially correct |
1 ms |
348 KB |
partial |
39 |
Partially correct |
1 ms |
344 KB |
partial |
40 |
Partially correct |
0 ms |
348 KB |
partial |
41 |
Partially correct |
0 ms |
348 KB |
partial |
42 |
Partially correct |
21 ms |
8836 KB |
partial |
43 |
Partially correct |
22 ms |
8796 KB |
partial |
44 |
Partially correct |
21 ms |
8792 KB |
partial |
45 |
Partially correct |
24 ms |
8824 KB |
partial |
46 |
Partially correct |
22 ms |
8844 KB |
partial |
47 |
Partially correct |
21 ms |
8824 KB |
partial |
48 |
Execution timed out |
4517 ms |
8784 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 |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
1 ms |
348 KB |
ok |
8 |
Correct |
1 ms |
344 KB |
ok |
9 |
Correct |
16 ms |
2396 KB |
ok |
10 |
Correct |
255 ms |
31768 KB |
ok |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
1 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Correct |
1 ms |
348 KB |
ok |
15 |
Correct |
0 ms |
348 KB |
ok |
16 |
Correct |
1 ms |
344 KB |
ok |
17 |
Correct |
1 ms |
348 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 |
Partially correct |
1 ms |
348 KB |
partial |
23 |
Partially correct |
0 ms |
348 KB |
partial |
24 |
Partially correct |
1 ms |
348 KB |
partial |
25 |
Partially correct |
0 ms |
348 KB |
partial |
26 |
Partially correct |
1 ms |
348 KB |
partial |
27 |
Correct |
0 ms |
348 KB |
ok |
28 |
Correct |
0 ms |
348 KB |
ok |
29 |
Partially correct |
0 ms |
348 KB |
partial |
30 |
Partially correct |
1 ms |
348 KB |
partial |
31 |
Partially correct |
0 ms |
372 KB |
partial |
32 |
Partially correct |
1 ms |
348 KB |
partial |
33 |
Partially correct |
0 ms |
348 KB |
partial |
34 |
Partially correct |
1 ms |
600 KB |
partial |
35 |
Partially correct |
1 ms |
344 KB |
partial |
36 |
Partially correct |
0 ms |
348 KB |
partial |
37 |
Partially correct |
1 ms |
344 KB |
partial |
38 |
Partially correct |
0 ms |
348 KB |
partial |
39 |
Correct |
1 ms |
348 KB |
ok |
40 |
Correct |
1 ms |
348 KB |
ok |
41 |
Partially correct |
0 ms |
348 KB |
partial |
42 |
Partially correct |
1 ms |
348 KB |
partial |
43 |
Partially correct |
1 ms |
348 KB |
partial |
44 |
Partially correct |
1 ms |
344 KB |
partial |
45 |
Partially correct |
0 ms |
348 KB |
partial |
46 |
Partially correct |
0 ms |
348 KB |
partial |
47 |
Partially correct |
21 ms |
8836 KB |
partial |
48 |
Partially correct |
22 ms |
8796 KB |
partial |
49 |
Partially correct |
21 ms |
8792 KB |
partial |
50 |
Partially correct |
24 ms |
8824 KB |
partial |
51 |
Partially correct |
22 ms |
8844 KB |
partial |
52 |
Partially correct |
21 ms |
8824 KB |
partial |
53 |
Execution timed out |
4517 ms |
8784 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |