# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
980159 | vjudge1 | 축구 경기장 (IOI23_soccer) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
//int biggest_stadium(int n, vvi f)
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int cnt=0, x, y, n; cin>>n;
vvi f(n+1, vi(n+1, 0));
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
cin>>f[i][j];
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(f[i][j]==1){
cnt++;
y=i; x=j;
}
if(cnt>1) return 0;
int ans=1;
int aux=n*(n-1-y)+max((y+1)*x, (y+1)*(n-x-1));
ans=max(ans, aux);
aux=n*y+max((n-x-1)*(n-y), x*(n-y));
ans=max(ans, aux);
aux=n*x+max((n-x)*y, (n-x)*(n-y-1));
ans=max(ans, aux);
aux=n*(n-x-1)+max((x+1)*y, (x+1)*(n-y-1));
ans=max(ans, aux);
cout<<ans;
}