제출 #1336556

#제출 시각아이디문제언어결과실행 시간메모리
1336556limits축구 경기장 (IOI23_soccer)C++20
6 / 100
177 ms31768 KiB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3,unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define f0r(i, n) for (auto i = 0; i < (n); ++i)
#define fnr(i, n, k) for (auto i = (n); i < (k); ++i)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define F first
#define S second
#define ctn(x) cout << x << '\n'
#define forl(a, l) for (auto a : l)
#define ctl(l) for (auto &a : (l)) cout << a << ' '; cout << endl;
#define lb(v, x) (lower_bound(all(v), x) - begin(v))
#define ub(v, x) (upper_bound(all(v), x) - begin(v))
#define pq priority_queue

template <class T>
using V = vector<T>;
using ll = long long;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int, int>;
using ti = tuple<int, int, int>;
using Adj = V<vi>;
using vvi = V<vi>;

#include "soccer.h"

int biggest_stadium(int N, std::vector<std::vector<int>> F) {
	V<pi> ts;
	bool corn = 1;
	f0r(i, N) f0r(j, N) {
		if (F[i][j]) {
			ts.pb({i, j});
			corn &= (i == 0 || i == N-1) && (j == 0 || j == N-1);
		}
	}
	if (ts.size() == 0) {
		return N*N;
	}
	if (ts.size() == 1) {
		auto [ii, jj] = ts[0];
		vi vl(4);
		f0r(k, 4) {
			f0r(i, N) f0r(j, N) {
				bool ok = (i != ii && ((i < ii) != (k & 1))) || (j != jj && ((j  < jj) != !!(k & 2)));
				vl[k] += ok;
			}
		}
		return *max_element(all(vl));
	}
	return corn ? N*N : 0;
}
#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...