Submission #1021974

#TimeUsernameProblemLanguageResultExecution timeMemory
1021974j_vdd16Soccer Stadium (IOI23_soccer)C++17
0 / 100
4601 ms63092 KiB
#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

//#define int long long
#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;


int biggest_stadium(int n, vvi f) {
	vvi high(n, vi(n)), low(n, vi(n));
	loop(x, n) {
		high[x][0] = 1 - f[x][0];
		for (int y = 1; y < n; y++) {
			if (f[x][y])
				high[x][y] = 0;
			else
				high[x][y] = high[x][y - 1] + 1;

		}

		low[x][n - 1] = 1 - f[x][n - 1];
		for (int y = n - 2; y >= 0; y--) {
			if (f[x][y])
				low[x][y] = 0;
			else
				low[x][y] = low[x][y + 1] + 1;
		}


		//loop(y, n)
		//	cout << high[x][y] << low[x][y] << ' ';

		//cout << endl;
	}
	//cout << endl;

	int result = 0;
	loop(x, n) {
		loop(y, n) {
			int count = 0;
			if (f[x][y] == 0) {
				int h = INT_MAX, l = INT_MAX;
				for (int x2 = x; x2 < n; x2++) {
					h = min(high[x2][y], h);
					count += h;

					l = min(low[x2][y], l);
					count += max(0, l - 1);
				}
				h = high[x][y], l = low[x][y];
				for (int x2 = x - 1; x2 >= 0; x2--) {
					h = min(high[x2][y], h);
					count += h;

					l = min(low[x2][y], l);
					count += max(0, l - 1);
				}

				result = max(result, count);
			}
			//cout << count / 10 << count % 10 << ' ';
		}
		//cout << endl;
	}
	return result;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...