답안 #1025694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1025694 2024-07-17T08:49:03 Z j_vdd16 축구 경기장 (IOI23_soccer) C++17
48 / 100
4500 ms 7948 KB
#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;

bool sort1(ii a, ii b) {
	return a.first < b.first || (a.first == b.first && a.second > b.second);
}
bool sort2(ii a, ii b) {
	return a.second > b.second || (a.second == b.second && a.first < b.first);
}

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

		}

		down[n - 1][x] = 1 - f[n - 1][x];
		for (int y = n - 2; y >= 0; y--) {
			if (f[y][x])
				down[y][x] = 0;
			else
				down[y][x] = down[y + 1][x] + 1;
		}
	}
	loop(y, n) {
		left[y][0] = 1 - f[y][0];
		for (int x = 1; x < n; x++) {
			if (f[y][x])
				left[y][x] = 0;
			else
				left[y][x] = left[y][x - 1] + 1;

		}

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

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

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

	int result = 0;
	loop(y, n) {
		loop(x, n) {
			if (f[y][x]) {
				cerr << "00 ";
				continue;
			}

			int count1 = 0, count2 = 0;
			
			int l = 0, r = n - 1;
			vii intervals;
			for (int y2 = y; y2 < y + down[y][x]; y2++) {
				l = max(l, x - left[y2][x] + 1);
				r = min(r, x + right[y2][x] - 1);
				if (l > r)
					break;

				intervals.push_back({ l, r });
			}

			l = x - left[y][x] + 1;
			r = x + right[y][x] - 1;
			for (int y2 = y - 1; y2 > y - up[y][x]; y2--) {
				l = max(l, x - left[y2][x] + 1);
				r = min(r, x + right[y2][x] - 1);
				if (l > r)
					break;

				intervals.push_back({ l, r });
			}

			sort(all(intervals), sort1);
			l = 0, r = n - 1;
			for (auto [li, ri] : intervals) {
				l = max(l, li);
				r = min(r, ri);

				count1 += r - l + 1;
			}

			sort(all(intervals), sort2);
			l = 0, r = n - 1;
			for (auto [li, ri] : intervals) {
				l = max(l, li);
				r = min(r, ri);

				count2 += r - l + 1;
			}
			
			int count = max(count1, count2);
			result = max(result, count);
			cerr << count / 10 << count % 10 << ' ';
		}
		cerr << endl;
	}
	return result;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 80 ms 716 KB ok
8 Execution timed out 4530 ms 7868 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 600 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 344 KB ok
9 Correct 1 ms 436 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Correct 1 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 600 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 344 KB ok
10 Correct 1 ms 436 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 1 ms 348 KB ok
14 Correct 1 ms 348 KB ok
15 Correct 1 ms 344 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 348 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 1 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 344 KB ok
24 Correct 1 ms 348 KB ok
25 Correct 1 ms 436 KB ok
26 Correct 1 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 600 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 1 ms 344 KB ok
12 Correct 1 ms 436 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 1 ms 344 KB ok
18 Correct 1 ms 348 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 1 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 1 ms 348 KB ok
23 Correct 1 ms 348 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 1 ms 344 KB ok
26 Correct 1 ms 348 KB ok
27 Correct 1 ms 436 KB ok
28 Correct 1 ms 348 KB ok
29 Correct 1 ms 348 KB ok
30 Correct 3 ms 348 KB ok
31 Correct 3 ms 348 KB ok
32 Correct 2 ms 348 KB ok
33 Correct 2 ms 348 KB ok
34 Correct 2 ms 348 KB ok
35 Correct 2 ms 348 KB ok
36 Correct 1 ms 348 KB ok
37 Correct 2 ms 348 KB ok
38 Correct 2 ms 348 KB ok
39 Correct 2 ms 348 KB ok
40 Correct 3 ms 348 KB ok
41 Correct 4 ms 460 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 600 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 1 ms 344 KB ok
12 Correct 1 ms 436 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 1 ms 344 KB ok
18 Correct 1 ms 348 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 1 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 1 ms 348 KB ok
23 Correct 1 ms 348 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 1 ms 344 KB ok
26 Correct 1 ms 348 KB ok
27 Correct 1 ms 436 KB ok
28 Correct 1 ms 348 KB ok
29 Correct 1 ms 348 KB ok
30 Correct 3 ms 348 KB ok
31 Correct 3 ms 348 KB ok
32 Correct 2 ms 348 KB ok
33 Correct 2 ms 348 KB ok
34 Correct 2 ms 348 KB ok
35 Correct 2 ms 348 KB ok
36 Correct 1 ms 348 KB ok
37 Correct 2 ms 348 KB ok
38 Correct 2 ms 348 KB ok
39 Correct 2 ms 348 KB ok
40 Correct 3 ms 348 KB ok
41 Correct 4 ms 460 KB ok
42 Partially correct 946 ms 7552 KB partial
43 Correct 771 ms 7556 KB ok
44 Partially correct 3301 ms 7948 KB partial
45 Execution timed out 4540 ms 7848 KB Time limit exceeded
46 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 80 ms 716 KB ok
9 Execution timed out 4530 ms 7868 KB Time limit exceeded
10 Halted 0 ms 0 KB -