# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918828 | ErJ | Soccer Stadium (IOI23_soccer) | C++17 | 350 ms | 86864 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<pair<ll, ll>>
#define pp pair<ll, ll>
#define qi queue<ll>
#define qp queue<pp>
#define pqi priority_queue<ll>
#define pqp priority_queue<pp>
#define mi map<ll, ll>
#define mpi map<pp, ll>
#define mip map<ll, pp>
#define mpp map<pp, pp>
#define mb map<ll, bool>
#define si set<ll>
#define sp set<pp>
#define mod 1000000007
#define rep(a, b) for(int a = 0; a < (b); a++)
#define inf 1000000000000000000
bool isOK(int n, vector<vector<int>> F) {
vp okraje(n);
for (int i = 0; i < n; i++) {
int pocet = 0;
for (int j = 1; j < n; j++) {
if (F[i][j] != F[i][j - 1]) {
pocet++;
}
}
if (F[i][n - 1] == 0) pocet++;
if (F[i][0] == 0) pocet++;
if (pocet > 2) {
return 0;
}
okraje[i] = { -1, -1 };
for (int j = 0; j < n; j++) {
if (F[i][j] == 0) {
okraje[i].first = j;
break;
}
}
for (int j = n - 1; j >= 0; j--) {
if (F[i][j] == 0) {
okraje[i].second = j;
break;
}
}
}
for (int i = 0; i < okraje.size(); i++) {
for (int j = 0; j < okraje.size(); j++) {
if (!(((okraje[i].first <= okraje[j].first) && (okraje[i].second >= okraje[j].second)) || (((okraje[j].first <= okraje[i].first) && (okraje[j].second >= okraje[i].second))))) {
if (okraje[i].first != -1 && okraje[j].first != -1) {
return 0;
}
}
}
}
return 1;
}
int biggest_stadium(int n, vector<vector<int>> F) {
vector<vector<int>> FT(n);
int ans = 0;
for (int i = 0; i < n; i++) {
FT[i].resize(n);
for (int j = 0; j < n; j++) {
if (F[i][j] == 0) ans++;
FT[i][j] = F[j][i];
}
}
if (isOK(n, F) && isOK(n, FT)) {
return ans;
}
else {
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |