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 "soccer.h"
#define vi vector<int>
#define ll long long
using namespace std;
int kum(vector<vi>& a, int i, int j, int ii, int jj)
{
return a[ii][jj]-a[ii][j-1]-a[i-1][jj]+a[i-1][j-1];
}
int biggest_stadium(int n, vector<vector<int>> f)
{
vector<vi> a(n+1, vi(n+1));
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
a[i][j] = a[i-1][j]+a[i][j-1]-a[i-1][j-1]+f[i-1][j-1];
int rez = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
for (int ii = 0; ii < n; ii++)
for (int jj = 0; jj < n; jj++)
for (int iii = 0; iii < n; iii++)
for (int jjj = 0; jjj < n; jjj++)
for (int iiii = 0; iiii < n; iiii++)
for (int jjjj = 0; jjjj < n; jjjj++)
{
int pl = (i+1)*(j+1)+(n-jj)*(ii+1)+(n-iii)*(jjj+1) + (n-iiii)*(n-jjjj);
int vs = kum(a, 1, 1, i+1, j+1);
vs += kum(a, 1, jj+1, ii+1, n);
vs += kum(a, iii+1, 1, n, jj+1);
vs += kum(a, iiii+1, jjjj+1, n, n);
if (vs >= a[n][n])
rez = max(rez, n*n-pl);
}
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |