제출 #1056142

#제출 시각아이디문제언어결과실행 시간메모리
1056142Ignut축구 경기장 (IOI23_soccer)C++17
6 / 100
161 ms39572 KiB
/* Ignut started: 13.08.2024 now: 13.08.2024 ████████████████████████████████████████████████████████████████████ ████████████████████████████████ ████████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████ ██████████████████ ██████████████████ ██████ ██████ ██████████████ ██████████████ ██████ ██████ ██ ████████████ ████████████ ██ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ██████ ██████ ██████ ██████ ██████████ ██████████ ██████ ██████ ██████ ██████ ████████ ████████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ████ ████ ████ ████ ██████ ██████ ██████████ ████ ██████████ ██████ ██████ ██ ██████ ████████ ██████ ██ ██████ ██████ ██████ ████████ ██████ ██████ ██████ ██ ██ ██████ ██████████████████████ ████ ████ ██████████████████████ ████████████████████████ ██ ██ ████████████████████████ ██████████████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ████████████████████████████████████████████████████████████████████ */ #include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 2222; int n; vector<vector<int>> f; bool used[MAXN][MAXN]; vector<pair<int, int>> delta = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}}; bool Good(int i, int j) { return i >= 0 && j >= 0 && i < n && j < n && f[i][j] == 0 && !used[i][j]; } int cnt = 0; void dfs(int i, int j) { cnt ++; used[i][j] = true; for (auto [di, dj] : delta) { int ci = i + di, cj = j + dj; if (Good(ci, cj)) { dfs(ci, cj); } } } int biggest_stadium(int N, vector<vector<int>> F) { for (int i = 0; i < N; i ++) { for (int j = 0; j < N; j ++) { if (F[i][j] == 0) continue; int mn = N * N; mn = min(mn, (i + 1) * (j + 1)); mn = min(mn, (N - i) * (N - j)); mn = min(mn, (N - i) * (j + 1)); mn = min(mn, (i + 1) * (N - j)); return N * N - mn; } } return N * N; n = N; f = F; for (int i = 0; i < N; i ++) { for (int j = 0; j < N; j ++) { if (F[i][j] == 1) continue; bool haveT = false; for (int e = i; e < N; e ++) { haveT |= F[e][j]; if (F[e][j] == 0 && haveT) { return 0; } } haveT = false; for (int e = j; e < N; e ++) { haveT |= F[i][e]; if (F[i][e] == 0 && haveT) { return 0; } } } } vector<pair<int, int>> vec; for (int i = 0; i < N; i ++) for (int j = 0; j < N; j ++) if (F[i][j] == 0) vec.push_back({i, j}); int sum = N * N; for (int i = 0; i < N; i ++) for (int j = 0; j < N; j ++) sum -= F[i][j]; dfs(vec[0].first, vec[0].second); if (cnt != sum) return 0; return sum; }
#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...