#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
const ll big = 1e9;
struct pos{
ll x,y;
bool operator<(const pos &o) const{
return x!=o.x?x<o.x:y<o.y;
}
};
struct dsu{
ll c;
vector<ll> p;
dsu(ll N):c(N),p(N,-1){}
ll g(ll i){
return p[i]<0?i:p[i] = g(p[i]);
}
bool m(ll a, ll b){
a = g(a),b=g(b);
if(a==b) return false;
c--;
if(p[a]>p[b]) swap(a,b);
p[a] += p[b];
p[b] = a;
return true;
}
};
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
auto &a = F;
ll n = N;
if(n<=3){
ll ret = 0;
vector<vector<ll>> dis(n*n,vector<ll>(n*n,big));
for(ll i = 0;i<n;i++){
for(ll j = 0;j<n-1;j++){
if (!a[i][j]&&!a[i][j+1]){
dis[i*n+j][i*n+(j+1)] = 1;
}
if (!a[j][i]&&!a[j+1][i]){
dis[j*n+i][(j+1)*n+i] = 1;
}
}
}
if(n==3){
for(ll i = 0;i<n;i++){
if (!a[i][0]&&!a[i][1]&&!a[i][2]){
dis[i*n+0][i*n+2] = 1;
}
if (!a[0][i]&&!a[1][i]&&!a[2][i]){
dis[0*n+i][2*n+i] = 1;
}
}
}
for(ll i = 0;i<n*n;i++){
for(ll j = 0;j<n*n;j++){
for(ll k = 0;k<n*n;k++){
dis[i][k] = min(dis[i][k],dis[i][j]+dis[j][k]);
}
}
}
for(ll x = 0;x<(1<<n*n);x++){
ll ok = 1;
for(ll i = 0;i<n*n;i++)if(x>>i&1){
if (a[i/n][i%n]) ok = 0;
for(ll j = 0;i<n*n;i++)if(x>>j&1){
if (dis[i][j]>2) ok = 0;
}
}
if (ok) ret = max(ret,__builtin_popcountll(x));
}
return ret;
}
vector<pos> v;
for(ll i = 0;i<n;i++){
for(ll j = 0;j<n;j++){
if (F[i][j]){
ll v1 = j*n+(n-i-1)*(n-j);
ll v2 = j*n+i*(n-j);
ll v3 = (n-j-1)*n+(n-i-1)*(j+1);
ll v4 = (n-j-1)*n+i*(j+1);
return max({v1,v2,v3,v4});
}
}
}
return n*n;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Incorrect |
0 ms |
348 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
344 KB |
ok |
3 |
Partially correct |
0 ms |
600 KB |
partial |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
344 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |