제출 #1064113

#제출 시각아이디문제언어결과실행 시간메모리
1064113AmirAli_H1축구 경기장 (IOI23_soccer)C++17
6 / 100
197 ms47404 KiB
// In the name of Allah #include <bits/stdc++.h> #include "soccer.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define F first #define S second #define endl '\n' #define sep ' ' #define pb push_back #define Mp make_pair #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) const int maxn = 2000 + 4; int n; int A[maxn][maxn]; vector<pii> ls; bool cmp(pii i, pii j) { return ((i.S - i.F) > (j.S - j.F)); } bool is_ok() { ls.clear(); for (int i = 0; i < n; i++) { int x = 0; for (int j = 0; j < n; j++) { if (A[i][j] != A[i][x]) { if (A[i][x] == 0) ls.pb(Mp(x, j - 1)); x = j; } } } sort(all(ls), cmp); for (int i = 1; i < len(ls); i++) { if (ls[i].F < ls[i - 1].F || ls[i].S > ls[i - 1].S) return 0; } return 1; } int check() { int num = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) num += (A[i][j] == 0); } bool ok = 1; ok &= is_ok(); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) swap(A[i][j], A[j][i]); } ok &= is_ok(); for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) swap(A[i][j], A[j][i]); } if (ok) return num; else return 0; } int biggest_stadium(int N, vector<vector<int>> F) { n = N; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { A[i][j] = F[i][j]; if (A[i][j] == 1) ls.pb(Mp(i, j)); } } if (len(ls) == 0) return (n * n); else if (len(ls) == 1) { int i = ls.back().F, j = ls.back().S; return (n * n) - (min(i + 1, n - i) * min(j + 1, n - j)); } return check(); }
#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...