Submission #841763

#TimeUsernameProblemLanguageResultExecution timeMemory
841763emuyumiSoccer Stadium (IOI23_soccer)C++17
0 / 100
4551 ms5100 KiB
#include "soccer.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int biggest_stadium(int N, vector<vector<int>> F) { auto sum = [&](vector<vector<int>> v) -> int { int good = 0; for (int sx = 0; sx < N; ++sx) for (int sy = 0; sy < N; ++sy) { good += v[sx][sy]; } return good; }; int good = N*N - sum(F); int ans = 0; for (int sx = 0; sx < N; ++sx) for (int sy = 0; sy < N; ++sy) { if (F[sx][sy]) continue; vector<vector<int>> cur(N, vector<int>(N)); for (int i = sx; i < N; ++i) { if (F[i][sy]) break; cur[i][sy] = 1; } for (int i = sx; i >= 0; --i) { if (F[i][sy]) break; cur[i][sy] = 1; } for (int j = sy; j < N; ++j) { if (F[sx][j]) break; cur[sx][j] = 1; } for (int j = sy; j >= 0; --j) { if (F[sx][j]) break; cur[sx][j] = 1; } const int dx[] = {1, 1, -1, -1}; const int dy[] = {1, -1, 1, -1}; for (int d = 0; d < 4; ++d) { for (int i = sx + dx[d]; i < N && i >= 0; i += dx[d]) { for (int j = sy + dy[d]; j < N && j >= 0; j += dy[d]) { // cerr << "|" << i << " " << j << '\n'; if (cur[i - dx[d]][j] && cur[i][j - dy[d]] && !F[i][j]) { cur[i][j] = 1; } } } } ans = max(ans, sum(cur)); // cerr << sx << " " << sy << '\n'; // for (int i = 0; i < N; ++i) { // for (int j = 0; j < N; ++j) { // cerr << cur[i][j]; // } // cerr << '\n'; // } if (ans == good) break; } return ans; }
#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...