# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
841786 | 2023-09-02T05:38:29 Z | ntannn | Soccer Stadium (IOI23_soccer) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> //#pragma GCC optimize("O3,unroll-loops,no-stack-protector") //#pragma GCC target("sse4,avx2,fma") #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() using namespace std; typedef long long ll; typedef pair<int,int> ii; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef vector<vi> vvi; const int N = 1e6+10; const ll MOD = 1e9+7; int n; vvi a; void solve() { for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(a[i][j] == 1) { return cout << n*n - min({(i+1)*(j+1), (i+1)*(n-j), (n-i)*(j+1), (n-i)*(n-j)}), void(); } } } cout << n*n; } void init() { cin >> n; for(int i = 0; i < n; i++) { vi temp; temp.resize(n); for(int j = 0; j < n; j++) cin >> temp[j]; a.eb(temp); } } #define task "a" int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int test_case = 1; //cin >> test_case; while(test_case--) { init(); solve(); } }